www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Tutorial on LDC's -ftime-trace

reply Mike Parker <aldacron gmail.com> writes:
Dennis Korpel has a new tutorial out on the foundation's YouTube 
channel, showing how to employ LDC's -ftime-trace option to 
improve your project's compile times. This can come in handy if 
you're heavily using metaprogramming or CTFE.

https://youtu.be/b8wZqU5t9vs
May 01 2023
next sibling parent reply Johan <j j.nl> writes:
On Monday, 1 May 2023 at 14:00:23 UTC, Mike Parker wrote:
 Dennis Korpel has a new tutorial out on the foundation's 
 YouTube channel, showing how to employ LDC's -ftime-trace 
 option to improve your project's compile times. This can come 
 in handy if you're heavily using metaprogramming or CTFE.

 https://youtu.be/b8wZqU5t9vs
Thanks Dennis for making the video. Does anybody have an idea about how change the txt output to trick code-folding editors in enabling folding the timetrace2txt output? 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. cheers, Johan
May 01 2023
next sibling parent reply Johan <j j.nl> writes:
On Monday, 1 May 2023 at 17:56:21 UTC, Johan wrote:
 On Monday, 1 May 2023 at 14:00:23 UTC, Mike Parker wrote:
 Dennis Korpel has a new tutorial out on the foundation's 
 YouTube channel, showing how to employ LDC's -ftime-trace 
 option to improve your project's compile times. This can come 
 in handy if you're heavily using metaprogramming or CTFE.

 https://youtu.be/b8wZqU5t9vs
Thanks Dennis for making the video. Does anybody have an idea about how change the txt output to trick code-folding editors in enabling folding the timetrace2txt output?
Looks like indentation alone would already do the trick for SublimeText. So I'll see about implementing an `--indentation=x` option for timetrace2txt to indent the list entries instead of showing the fancy tree view. cheers, Johan
May 01 2023
parent Johan <j j.nl> writes:
On Monday, 1 May 2023 at 18:12:47 UTC, Johan wrote:
 On Monday, 1 May 2023 at 17:56:21 UTC, Johan wrote:
 On Monday, 1 May 2023 at 14:00:23 UTC, Mike Parker wrote:
 Dennis Korpel has a new tutorial out on the foundation's 
 YouTube channel, showing how to employ LDC's -ftime-trace 
 option to improve your project's compile times. This can come 
 in handy if you're heavily using metaprogramming or CTFE.

 https://youtu.be/b8wZqU5t9vs
Thanks Dennis for making the video. Does anybody have an idea about how change the txt output to trick code-folding editors in enabling folding the timetrace2txt output?
Looks like indentation alone would already do the trick for SublimeText. So I'll see about implementing an `--indentation=x` option for timetrace2txt to indent the list entries instead of showing the fancy tree view.
Added a very simple option for this: https://github.com/ldc-developers/ldc/pull/4391 Works well with SublimeText (https://www.youtube.com/watch?v=80UUPMUAP-g), makes it much easier to navigate through large traces. Dennis commented on this in his video (having to switch to a better viewer than just simple text); hope this helps a little. cheers, Johan
May 05 2023
prev sibling next sibling parent reply Guillaume Piolat <first.last spam.org> writes:
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.
May 02 2023
parent Dennis <dkorpel gmail.com> writes:
On Tuesday, 2 May 2023 at 12:28:32 UTC, Guillaume Piolat wrote:
 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.
True, but you don't get CTFE tracking and the timetrace2txt tool with those earlier versions, so I wanted to make sure viewers don't get tripped up by that when following the video.
May 02 2023
prev sibling parent Dennis <dkorpel gmail.com> writes:
On Monday, 1 May 2023 at 17:56:21 UTC, Johan wrote:
 - 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.
Good suggestions. This video I wanted to focus on setting it up and getting started, but I might do a follow up with more advanced usage.
May 02 2023
prev sibling parent WebFreak001 <d.forum webfreak.org> writes:
On Monday, 1 May 2023 at 14:00:23 UTC, Mike Parker wrote:
 Dennis Korpel has a new tutorial out on the foundation's 
 YouTube channel, showing how to employ LDC's -ftime-trace 
 option to improve your project's compile times. This can come 
 in handy if you're heavily using metaprogramming or CTFE.

 https://youtu.be/b8wZqU5t9vs
cool, thanks for the tutorial! These tutorials can help show things that are used commonly, that can ideally be simplified in IDEs such as code-d/serve-d as well. The tracy viewer or web viewer could for example be embedded in the IDE. Compilation times for modules and methods could also be shown inside the editor / code. There was once an experimental setting in code-d with dmd for imports which just tried compiling with a single import, but this would be much more accurate and be able to display times relative to the total compilation time.
May 01 2023