Tutorial on LDC's -ftime-trace

Guillaume Piolat first.last at spam.org
Tue May 2 12:28:32 UTC 2023


On Monday, 1 May 2023 at 17:56:21 UTC, Johan wrote:
> Two additions:
> - You forgot about the `--ftime-trace-granularity=<uint>` 
> option ;-P
> - The timetrace can also tell you which parts of your program 
> to separate into separate files + separate compilation.
>

More tips:
- `--ftime-trace` was introduced a while back, at least back in 
LDC 1.27 or perhaps even earlier. I've tested it in LDC 1.30 and 
works perfectly. So you can probably already use it without 
upgrading LDC.

- `--ftime-trace-granularity=0` will display everything, very 
useful to highlight how fast things could be without accidentally 
being slow for some constructs (like LDC's `__ir_pure` :) ).


Just put this in your dub.json:

     `"dflags-ldc": ["--ftime-trace", 
"--ftime-trace-granularity=0"],

DUB will then output the trace in lastest `.dub/build/blah` 
directory. This is an amazing addition to D quality of life.


More information about the Digitalmars-d-announce mailing list