Profiling DMD's Compilation Time with dmdprof

Atila Neves atila.neves at gmail.com
Thu Nov 8 10:19:01 UTC 2018


On Thursday, 8 November 2018 at 04:16:44 UTC, Manu wrote:
> On Tue, Nov 6, 2018 at 10:05 AM Vladimir Panteleev via 
> Digitalmars-d-announce <digitalmars-d-announce at puremagic.com> 
> wrote:
>>
>> This is a tool + article I wrote in February, but never got 
>> around to finishing / publishing until today.
>>
>> https://blog.thecybershadow.net/2018/02/07/dmdprof/
>>
>> Hopefully someone will find it useful.
>
> "Indeed, a clean build of DMD itself (about 170’000 lines of D 
> and 120’000 lines of C/C++) takes no longer than 4 seconds to 
> build on a rather average developer machine."
>
> ...what!? DMD takes me... (compiling) ... 1 minute 40 seconds 
> to build! And because DMD does all-files-at-once compilation, 
> rather than separate compilation for each source file, whenever 
> you change just one line in one file, you incur that entire 
> build time, every time, because it can't just rebuild the one 
> source file that changed. You also can't do multi-processor 
> builds with all-in-one build strategies.
>
> 4 seconds? That's just untrue. D is actually kinda slow these 
> days... In my experience it's slower than modern C++ compilers 
> by quite a lot.

Everything on Windows is slower. I'm 99% sure the fault lies with 
NTFS.

I worked on a cross platform framework back in the day, nearly 
all of the code was identical between Linux and Windows. On the 
same dual-boot machine the build was between one and two orders 
of magnitude slower on Windows. Again: same code, same machine, 
no VMs. _Anything_ that used the filesystem was significantly 
slower, including CMake. It got to the point that the devs that 
preferred to use Windows only ever used the unity build because 
incremental ones were too slow to bear.

I'd love to know how long it takes to build clang on your machine.


More information about the Digitalmars-d-announce mailing list