[phobos] FreeBSD 32 still fails unittests for std.datetime

Jonathan M Davis jmdavisProg at gmx.com
Tue May 3 01:11:30 PDT 2011


> On 5/2/2011 11:06 PM, Jonathan M Davis wrote:
> > I'm afraid that I don't understand what the problem is then. Can the
> > linker not handle a 4.6 Mb object file? Granted, that's not a small
> > file, but I wouldn't have thought that that would do in the linker.
> 
> It is an unusually large .o file, though. Maybe ld has some exponential
> behavior with the size of a .o file.
> 
> > And, of course, that raises the question as to why the object file is so
> > large when compiling with unit tests.
> 
> (I made a mistake, it's 5Mb compiled with -unittest.) By replacing a few
> _assertPred's with assert, compiling and looking at the .o file size, each
> one consumes an extra 400 to over 1000 bytes. There are 4000 _assertPred's
> there, so that explains where the size comes from. There are 5 args that
> get pushed on the stack for each call to _assertPred, and one of those is
> a delegate (the lazy parameter).
> 
> I appreciate that using _assertPred saves you time and effort in
> development, but once it is developed it is a bit expensive to carry it
> around. I wonder if there's an easy way to swap it out with assert.

Simply swapping it out is not straightforward and would be annoying any time 
that any changes had to be made and something broke. Regardless, as I refactor 
the unit tests, the number of calls to _assertPred should decrease 
dramatically. Supposedly, Don was working on improving assert so that it 
provided decent output such that it was at least similar in benefit to 
_assertPred, but as far as I know, that hasn't gone anywhere yet. He's 
certainly busy with the CTFE at the moment in either case.

> Sigh. Even obj2asm crashes with this .o file, but that's my fault.
> 
> Running "strings" on the .o for a non-unittest compile shows a lot of
> redundant strings that can be factored out to save space, such as
> "Standard Time" appearing 80 times or so.

I don't believe that "Standard Time" is _ever_ in a string by itself. It's 
_always_ part of another string. So, replacing it would mean replacing a bunch 
of string literals with a smaller string literal plus a concatenation with an 
enum, const, or immutable string which held "Standard Time", and I'm not sure 
that that would help much. But maybe it would. It would arguably make those 
portions of the code less maintainable though. But maybe it would still be 
worth doing. I don't know quite what the repercussions would be either way.

- Jonathan M Davis


More information about the phobos mailing list