whatever I do, things get slower and bigger
BCS
ao at pathlink.com
Thu Mar 13 14:35:48 PDT 2008
I'm working on my parser generator and trying to shoe horn it into a smaller
memory foot print. One approach I'm trying, is to replace recursive templates
with CTFE function and string mixins. This is in an effort to reduce the
number of types that get declared (mostly I'm using struct templates). The
problem is that the CTFE functions seem to actually use MORE ram than the
templates do. I've tried a number of things like converting to an O(n log
n) concatenation system rather than a O(n^2) and other such tricks but everything
seems to be going backwards. Any advice? (D v1 BTW) I can post code if anyone
cares (it's kind of large: 1.2KLOC, takes a while to compile: ~6min, and
use a lot of RAM: ~2GB).
(after a bit more fiddling)
I've got it down to 1GB of ram (Yeah!). My conclusions: don't build strings
with CTFE unless it's a lot harder to do it with templates. It seems that
CTFE is a bigger memory hog than templates even with temples memoizing everything
into the symbol tables.
More information about the Digitalmars-d-learn
mailing list