Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This is a DMD compilation time profiler. It allows profiling and visualizing which parts of the D code take up most of the time compiling.


Click image above for working tooltips and hyperlinks.

Example taken from here.


  1. Build a debug DMD, e.g. using make -f posix.mak BUILD=debug in dmd/src.

  2. Run the debug DMD you built under GDB, and pass the program to compile and profile:

    $ gdb --args .../dmd/generated/linux/debug/64/dmd -o- your_program.d

    If you use a build tool like rdmd or Dub, you need to first find the dmd invocation it uses, then use that. Try enabling verbose output.

  3. Load the GDB script from this repository:

    (gdb) source path/to/
  4. Run the profiler:

    (gdb) python DMDProfiler().profile()

    You can optionally specify a sampling interval:

    (gdb) python DMDProfiler(0.001).profile()

    The sampling interval specifies the duration (in seconds) between samples taken. The default is 0.01, and the lowest possible value is 0, meaning to take samples as quickly as possible.

    Note that currently GDB leaks about 15-30 MB of memory per sample (!), so watch your memory usage to avoid crashing your machine.

    The profiler will save the results to a profile.json file.

  5. Use gprof2dot to generate a GraphViz .dot file, pipe it through the linkify program in this repository, and pipe the result into dot:

    ./ -f json path/to/profile.json --root=-2:-2 -n 2 -e 0 | rdmd path/to/linkify.d | dot -Tsvg > profile.svg

    Adjust gprof2dot -n parameter to taste.

    To generate correct, permanent links in the output file, you can specify Phobos and Druntime versions as Git commit SHA1s or tag names using the --phobos and --druntime arguments to linkify.


DMD compilation time profiler




No releases published

Sponsor this project


No packages published