CTFE slower than expected

Don Clugston dac at nospam.com
Wed May 30 01:53:01 PDT 2012


On 29/05/12 23:23, Philippe Sigaud wrote:
> On Tue, May 29, 2012 at 2:52 PM, Don Clugston<dac at nospam.com>  wrote:
>
>>> Is there any way to improve it?
>>
>>
>> Oh yeah. Orders of magnitude, easily.
>
> !
>
>> The slowness is not in any way
>> inherent to CTFE. The experience will be completely different, once I have
>> some time to work on it -- I know exactly how to do it.
>
> Did 2.058 or 2.059 see any new code for CTFE? Like the OP, I've the
> impression CTFE/mixins suddenly became far slower. I'm not
> complaining, I understand it's a difficult part of DMD, but I wondered
> if what I see is real or imaginary.

The behaviour of __traits(allMembers) changed (it now returns an array 
of string literals) and I expect that to be a little bit slower.
Compiling Phobos is now *much* slower than it used to be, due to changes 
in Phobos. (eg, import std.random; is unbelievably slow).


As for CTFE, certain cases became faster (eg, repeated use of global 
array literals).

But if you can pinpoint a case where CTFE itself became slower, I'd like 
to know.



More information about the Digitalmars-d mailing list