-2

This is a general question but with a specific use case. There is only a single and completely unaffordable profiler for the Xamarin framework. So this makes me wonder if there are some programming methods to work around this? Maybe something similar to debugging programs without a debugger - relying on console/file logging etc.

I am guessing it boils down to capturing certain metrics at right moments and then storing them somewhere for subsequent analysis. Pretty charts and interactive call trees I guess are probably just a matter of presenting metrics and their context a right way. Is there any additional magic going on? Something like decorating every method with "Before" and "After" code via reflection? Maybe a way of accessing the CLR/JVM memory heaps is also necessary?

Den
  • 4,827
  • 2
  • 32
  • 48
  • This question is to specific: https://softwareengineering.stackexchange.com/questions/393034/how-can-i-optimize-a-programs-performance-when-no-profiling-tools-are-available – Den Oct 23 '19 at 08:37
  • Possible duplicate of [How can I optimize a program's performance when no profiling tools are available?](https://softwareengineering.stackexchange.com/questions/393034/how-can-i-optimize-a-programs-performance-when-no-profiling-tools-are-available) – Pieter B Oct 23 '19 at 08:53
  • 1
    @PieterB: that question - though the headline sounds like a dupe at a first glance - does IMHO not really have an answer which can be applied here directly. – Doc Brown Oct 23 '19 at 11:21

1 Answers1

1

Maybe something similar to debugging programs without a debugger - relying on console/file logging

Not "something similar", but exactly this. In particular

  • find some timer or clock function of your environment with a resolution which fulfills your needs

  • use this to measure the execution time of certain code sections, and write that into a log file

  • try to isolate sections suspected to be performance critical, so you can run them multiple times as part of a "performance unit test"

  • compare the results of different runs when you change something in your code, like disabling some operation, or optimizing some operation (which is something you will usually do also when using a profiler)

Of course, without a profiler, this can become tedious work, but sometimes doing things semi-manually is your only viable option when you don't have better tools available.

Doc Brown
  • 199,015
  • 33
  • 367
  • 565