whatever I do, things get slower and bigger
Robert Fraser
fraserofthenight at gmail.com
Thu Mar 13 20:10:04 PDT 2008
Bill Baxter wrote:
> BCS wrote:
>> 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.
>>
>>
>
> Yes I believe Don has previously reported that CTFE manipulations on
> strings basically *never* free the intermediate strings. Basically the
> CTFE engine needs a garbage collector (or equiv).
>
> --bb
grep for 'delete' in the front-end code. It's not there very much :-).
More information about the Digitalmars-d-learn
mailing list