On 01/07/2017 06:32 PM, Gerald wrote:
On Saturday, 7 January 2017 at 16:46:38 UTC, dlang user wrote:
When I compile the HelloWorld.d demo code on version 3.4.1 in debug
mode the resulting file size is 26.4MB, when I compile the same code
with 3.5.0 the file size is 70.7MB, that is quite a jump in size. I
am using DMD V2.072.2 on 64bit Debian testing.
As you are probably aware, GtkD auto-generates code. Unfortunately,
adding the ability to remove event handlers generated an increase in the
size of code, instead of just tracking the delegate directly it now uses
a wrapper class to also track the connect flags and returned handlerId.
Right now a unique wrapper class is generated for each event handler
which I suspect is the primary culprit for the increase in size.
If this size increase is a major concern, one option might be for me to
try to use a generic wrapper class instead of a generating a unique one.
This would mean converting the generated code to cast the delegate
before using it.
I'll let Mike chime in with his thoughts first though before looking too
much into it.
I didn't expect a jump in size of that magnitude, but i didn't check for
In release builds the size difference is smaller, and the best results
are with ldc. (-O -release + strip) With ldc the HelloWorld demo is just
2.4MB (2.2MiB) a 0.2MB increase from the previous release.
For the library itself this is a bit more with a 30% increase in size.