Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile DUB binaries with LDC #1419

Closed
wilzbach opened this issue Mar 24, 2018 · 2 comments
Closed

Compile DUB binaries with LDC #1419

wilzbach opened this issue Mar 24, 2018 · 2 comments

Comments

@wilzbach
Copy link
Member

(from a recent discussion #1369 (comment) in which the resulting size of a DUB's binary was discussed)

Compiler Size
DMD 17M
LDC 13M
GDC 19M

DUB is currently compiled with DMD, because LDC doesn't support showing the stack for exceptions, but imho the increase in speed and reduced side justifies overlooking this. After all, this is a production release - not a debug build.

LDC has LTO easily available which results usually in ~10% performance improvement and also a noticeable binary size reduction.
I haven't done big tests, but a build of vibe.d without needing to rebuild goes reproducible down from 0.22s to 0.15s

So my question: how big of a performance gain would justify the missing stack trace for exceptions?
(reminder: here's what DMD generates https://run.dlang.io/is/vzByQy vs. LDC: https://run.dlang.io/is/6iG8ai)

This issue is just about the separately built binaries.
(there's https://issues.dlang.org/show_bug.cgi?id=18656 for the bundled dub with the official release archives)

@kinke
Copy link
Contributor

kinke commented Mar 24, 2018

LDC doesn't enforce the ld option --export-dynamic as DMD does, that's why the stacktrace is missing the symbol names (or rather the stack trace generator in druntime not reading from dwarf debuginfo but from the dynamic symbols table IIRC). So adding -L--export-dynamic makes them available, but may also lead to a big size increase: https://run.dlang.io/is/NXqZH5

wilzbach added a commit to wilzbach/dub that referenced this issue Mar 24, 2018
> LDC doesn't enforce the ld option --export-dynamic as DMD does, that's why the stacktrace is missing the symbol names (or rather the stack trace generator in druntime not reading from dwarf debuginfo but from the dynamic symbols table IIRC).

See also:

dlang#1419 (comment)
wilzbach added a commit to wilzbach/dub that referenced this issue Mar 24, 2018
wilzbach added a commit to wilzbach/dub that referenced this issue Mar 24, 2018
@wilzbach
Copy link
Member Author

So adding -L--export-dynamic makes them available, but may also lead to a big size increase:

Nice! I just tested this (without LTO) and with -L--export-dynamic the generated binary takes up 17M as well (that's the same as DMD's build). As the dub binary take 3.5M in a tar.gz archive currently, I doubt that this is a big problem.

I haven't gotten around creating a real benchmark for dub, so I just use a naive "dub describe".
On my system a dub describe of the dub-registry takes 0.32s - whereas the LDC binary takes in at 0.19s. This needs further testing of course before making a statement, but it looks like dub can be ~one third faster just by switching to LDC :)

Anyhow, I made a PR for this: #1420

wilzbach added a commit to wilzbach/dub that referenced this issue Mar 26, 2018
> LDC doesn't enforce the ld option --export-dynamic as DMD does, that's why the stacktrace is missing the symbol names (or rather the stack trace generator in druntime not reading from dwarf debuginfo but from the dynamic symbols table IIRC).

See also:

dlang#1419 (comment)
wilzbach added a commit to wilzbach/dub that referenced this issue Mar 26, 2018
s-ludwig added a commit that referenced this issue Apr 2, 2018
 Fix #1419 - Use LDC by default for the released binaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants