Le 2011-05-03 à 13:30, Steve Schveighoffer a écrit :
> This is not a fair response to this problem. When the code size triples
> (http://d.puremagic.com/issues/show_bug.cgi?id=2254) because you add the -lib
> switch, and adding unit tests adds to the size of the executable, even when
> unit tests are turned off
> (http://d.puremagic.com/issues/show_bug.cgi?id=5560) again, when adding the
> -lib switch, it's obvious to everyone (but you it seems) that the -lib switch
> is adding bloat. Bug 5660 proves that beyond all reasonable doubt.
>
> Whether it accounts for all the added bloat, I'm not sure. obj2asm is a
> great tool, but I am not an assembly developer, I can't always decipher
> what's going on. the -map switch only tells you what the compiler is
> outputting, it doesn't tell you if the output contains unnecessary bloat.
>
> Please, at least agree to look at bug 5560, it's irrefutable proof that the
> -lib switch adds bloat, it cannot get any simpler than that.
Interesting. I might have an answer to that.
DMD emits code in a special "multiobj" mode when using the -lib switch. I had
to disable this in my Objective-C-aware branch of the compiler because it
didn't play well with Objective-C class definitions (maybe I could make it
work, but I have more pressing things to do).
Now, I observe that Phobos compiled with my modified DMD makes 2501452 bytes,
whereas the one that comes bundled with DMD makes 6646800 bytes... Granted,
it's not exactly the same version of Phobos and druntime (I'm probably a little
behind but with a few things added to my druntime branch), but the stunning
difference leads me to believe "multiobj" might be the cause for this
difference in size.
If someone wants to experiment, just open src/mars.c in DMD's source and change
this line 842 from this:
global.params.multiobj = 1;
to this:
global.params.multiobj = 0;
I guess this will greatly reduce size of the library, although I have no idea
whether it will affect the size of the final executable or not.
--
Michel Fortin
[email protected]
http://michelf.com/
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos