Compiling to Heap for CTFE

Christian Kamm kamm.incasoftware at shift-at-left-and-remove-this.de
Tue Dec 18 08:27:53 PST 2007


Don Clugston wrote:

> I'm encountering some severe slowdowns through CTFE; I've had to optimise
> my CTFE code for speed. Interestingly, at the present time, the
> interpreter doesn't seem to be the problem. The real problem is that DMD
> doesn't seem to release CTFE memory properly. For example, when you change
> an element of a string, AFACT it creates a new string and NEVER deletes
> the original! So at present, CTFE optimisation is about minimising the
> number of variables created or modified, rather than minimising the number
> of operations.

> Some simple suggestions that would be major leaps forward in practical
> CTFE programming are:
> * gc at compile time, to stop the symbol table getting clogged up.

I have observed the same thing: the interpreter seems fast enough, but
memory usage grows rapidly when doing string/array operations. It's very
easy to use up all available memory.

This is the bugzilla issue, by the way:
http://d.puremagic.com/issues/show_bug.cgi?id=1382

Christian Kamm



More information about the Digitalmars-d mailing list