D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20391 - [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
Summary: [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-11-14 12:45 UTC by GoaLitiuM
Modified: 2020-03-21 03:56 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description GoaLitiuM 2019-11-14 12:45:47 UTC
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 GoaLitiuM 2019-11-14 12:52:40 UTC
Just to clarify: this performance regression does not just apply to compiling DMD, it also affects other projects as well.
Comment 2 GoaLitiuM 2019-11-14 13:27:51 UTC
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).
Comment 3 Seb 2019-12-13 18:16:13 UTC
Could it be that this solves your issue?

https://github.com/dlang/dmd/pull/10663
Comment 4 GoaLitiuM 2019-12-14 17:01:41 UTC
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 GoaLitiuM 2019-12-14 17:11:00 UTC
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 GoaLitiuM 2019-12-16 11:16:07 UTC
DMD 2.089.1 came out today and is still significantly slower than my own builds.
Comment 7 Rainer Schuetze 2020-01-08 21:43:35 UTC
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 Dlang Bot 2020-01-13 08:19:28 UTC
@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
Comment 9 basile-z 2020-01-13 09:32:44 UTC
How worth is this to fix considering that there are plan to deactivate -release for the official build ?

https://github.com/dlang/dmd/pull/10679
Comment 10 Dlang Bot 2020-01-13 10:12:18 UTC
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 Rainer Schuetze 2020-01-13 18:31:07 UTC
(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 GoaLitiuM 2020-02-05 01:25:45 UTC
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.
Comment 13 Rainer Schuetze 2020-02-05 07:30:20 UTC
see https://github.com/dlang/installer/pull/425