Compiler flags when profiling a build

Gregory II gman.22.II at gmail.com
Sun Oct 25 18:03:05 UTC 2020


On Sunday, 25 October 2020 at 14:47:50 UTC, Per Nordlöw wrote:
> On Sunday, 25 October 2020 at 14:34:54 UTC, Guillaume Piolat 
> wrote:
>> dub -b release-debug   # optimizations AND debug information
>
> Why not use dmd's own `-profile` flag? Is too intrusive on 
> performance? I've noticed a massive slow-down with about a 
> magnitude.

I've never used the flag but I don't imagine it is going to be 
any good anyways. Anything that adds to your own programs 
computation is going to skew it.

If you aren't profiling the final build, eg LDC with all 
optimizations and inlining on, then your optimizations are kind 
of pointless.

>> The AMD profiler is a very nice alternative to Intel Amplifier.
>
> I'm sitting on Linux. What is the preferred open alternative 
> there? What are the pros and cons of the choices oprofile, 
> gprof, sysprof, ...? Does anybody have a good comparison chart?
>
> I want to profile an application that parser files into ASTs 
> and generates text from those AST. Current bottleneck is 
> currently AST-node allocations.

Both AMD's and Intel's profilers support Linux. They give you 
access to hardware counters, at the very least you won't find 
profilers with more information than these. Pick whichever 
processor you have.

https://developer.amd.com/amd-uprof/
https://software.intel.com/content/www/us/en/develop/tools/vtune-profiler.html

I also use tracy, which integrates with your code to give you a 
more accurate picture. You have to write your own D wrapper 
though, and place additional code such as mixins to the functions 
you want to profile. Unlike D's -profile you can choose what to 
enable and narrow it down to a specific issue you are trying to 
fix. So that it doesn't slow your run times too much.

https://github.com/wolfpld/tracy




More information about the Digitalmars-d mailing list