On 5/3/2011 1:11 AM, Jonathan M Davis wrote:
Simply swapping it out is not straightforward and would be annoying any time
that any changes had to be made and something broke.
I understand it would be annoying, but it's also annoying to not be able to run
the unittests on Windows and FreeBSD. Considerable savings can be had by just
getting rid of the __FILE__ parameter, as it's all in the same file.
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.
If it has those extra features, the size will inevitably come with it.
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.
Looking at the code I see that you're doing a simple lookup table, but using
explicit code instead. Replacing it with a two column table:
string[][2] = [ ["AUS Central Standard Time", "Australia/Darwin"], ... ];
would run slower, but would occupy considerably less space than all those return
statements. Using a table will also enable supporting a case insensitive lookup.
If it's any consolation, I just discovered that std.range won't unittest on
FreeBSD with out of memory, too. I haven't investigated why.
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos