Bug 20391 – [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2019-11-14T12:45:47Z
Last change time
2020-03-21T03:56:36Z
Keywords
pull
Assigned to
No Owner
Creator
GoaLitiuM
Comments
Comment #0 by goalitium — 2019-11-14T12:45:47Z
Building DMD (excluding phobos and druntime, no optimizations) with the official 32-bit Windows release of DMD 2.089 takes about ~40% more time to finish than it did with DMD 2.088.1. For the comparison, 64-bit DMD (built with LDC2 and optimizations enabled) for both versions takes much less time than 32-bit counterparts.
Here are some measurements taken with my i7-2600K @ 4.2GHz:
DMD32 2.089: ~11 seconds
DMD32 2.088.1: ~8 seconds
DMD64 2.089: ~5 seconds
DMD64 2.088.1: ~5 seconds
Comment #1 by goalitium — 2019-11-14T12:52:40Z
Just to clarify: this performance regression does not just apply to compiling DMD, it also affects other projects as well.
Comment #2 by goalitium — 2019-11-14T13:27:51Z
It looks like the official builds are compiled with ENABLE_DEBUG=1, which also explains why my own DMD built DMD builds are faster too (~6 seconds with DMD32, ~7 seconds with DMD64).
I can't possibly know, I had no issues with building the DMD myself with these flags, the problem lies in the officially distributed binaries which seems to be missing them, and I have no idea how they are exactly built.
Comment #5 by goalitium — 2019-12-14T17:11:00Z
Maybe it wasn't clear enough, but the measurements in my first posts were measured with DMD binaries downloaded from https://dlang.org/download.html and building the same project with those versions, which in this case it was DMD ~master or DMD 2.088.1. Using my own binaries (the DMD64 versions, but DMD32 performs similarly) with ENABLE_RELEASE=1 does not show this regression at all.
Comment #6 by goalitium — 2019-12-16T11:16:07Z
DMD 2.089.1 came out today and is still significantly slower than my own builds.
Comment #7 by r.sagitario — 2020-01-08T21:43:35Z
dmd 2.090 is still slower than 2.088. dmd.exe is also built with debug symbols and contains strings only used by assertions, so I suspect it's just a debug build.
dub.exe also contains debug symbols, but it has always been this way.
Maybe a locally modified makefile during release build is also causing the dmd version to have the suffix -dirty.
@Martin any idea?
Comment #8 by dlang-bot — 2020-01-13T08:19:28Z
@rainers created dlang/dmd pull request #10721 "fix Issue 20391 - [REG 2.089] DMD compile times increased by 40% beca…" fixing this issue:
- fix Issue 20391 - [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
build release with ENABLE_RELEASE=1
https://github.com/dlang/dmd/pull/10721
dlang/dmd pull request #10721 "fix Issue 20391 - [REG 2.089] DMD compile times increased by 40% beca…" was merged into stable:
- 5da931ed8f56736fd08949dcdeaa5535944cc4ab by Rainer Schuetze:
fix Issue 20391 - [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
build release with ENABLE_RELEASE=1
https://github.com/dlang/dmd/pull/10721
Comment #11 by r.sagitario — 2020-01-13T18:31:07Z
(In reply to Basile-z from comment #9)
> How worth is this to fix considering that there are plan to deactivate
> -release for the official build ?
Building without -release is different from building without optimizations. Enabling asserts will probably cost a couple of percent, not 30-40%.
Comment #12 by goalitium — 2020-02-05T01:25:45Z
Here are the latest measurements when building a project including few dependencies with DUB (results are not comparable to my previous post):
2.089.0 built with LDC2
time elapsed: 8.2s
2.089.0
time elapsed: 15.3s
2.090.0
time elapsed: 15.3s
2.090.1-beta
time elapsed: 11.0s
The beta release clearly helped with the performance, but there are still room for improvements. You really should consider using LDC2 for final builds which seems to produce way more optimized binaries than DMD.