Profiling the DMD Compiler Itself
Walter Bright
newshound2 at digitalmars.com
Tue May 9 03:28:15 UTC 2023
If the dmd builder builds dmd with the ENABLE_PROFILE=1, the resulting compiler
will profile itself compiling a program. The results of the profile will be
emitted to the file trace.log, which is described here:
https://www.digitalmars.com/ctg/trace.html
Yes, dmd inherited the profiler from the Digital Mars C++ profiler.
It works by inserting code into the prolog and epilog of each function,
calculating the time it takes the function to execute. It turns out that this
takes a disastrously long time to run, so it is only useful for profiling with
fairly short programs. Trying to profile dmd itself will likely have to wait
until the sun becomes a red giant before it finishes.
But anyhow, profiling compiles of smaller programs can work out nicely, and with
the report in trace.log one can see where the problems are.
Happy profiling!
More information about the Digitalmars-d
mailing list