Refactor joiner to reduce symbol bloat.#5610
Conversation
Using Steven Schveighoffer's "horcrux" trick. In my range-heavy project, this single change resulted in a 50% reduction in executable size(!).
|
Thanks for your pull request, @quickfur! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
See PR dlang#5610 for further explanation.
|
Does @rainers recent work on compressed mangling help with this? |
PetarKirov
left a comment
There was a problem hiding this comment.
This looks like a transformation that could be done automatically by dmd, not top of what dlang/dmd#5855 would do to improve the encoding of symbols, though for the time being we need workarounds such as this, so LGTM.
wilzbach
left a comment
There was a problem hiding this comment.
I agree with @ZombineDev here, the problem is real and this is a nice solution to solve this problem for the critical bits for the time being (I will comment more on the other PR with the longer discussion).
Yes, the new mangling never repeats a type in the mangling. |
Using Steven Schveighoffer's "horcrux" trick. In my range-heavy project, this single change resulted in a 50% reduction in executable size(!). This is on top of the reductions already realized by my own application of the same trick (see forum discussion below).
Relevant discussions:
This PR is just one of many to come. Some of the most common range functions in Phobos are Voldemort types, which cause nasty symbol size bloat. These PRs aim to reduce this bloat and make heavily ranged-based code more viable for D. (At least until the DMD PR is pulled. But this problem is quickly becoming a showstopper for me in the meantime, because yesterday I started running into DMD's 10MB symbol size limit. Not to mention ELF errors caused by excessively large symbols.)