backporting features to D1

Frank Benoit keinfarbton at googlemail.com
Sun Oct 12 04:57:06 PDT 2008


Christopher Wright schrieb:
> Jarrett Billingsley wrote:
>> Then address the issues of stack vs. heap delegates.
> 
> That is not required for Tango to function properly with D2. It's a
> performance optimization only. A significant one, but no more.

I disagree here.
If you use lambdas for filters in inner loops, that is a main
performance hit. It is more than just "optimization", it is a reason to
change the design. It is a reason not to use D2. It is a D2 show-stopper.
Even worse, no error message is showing you the problematic places, D2
just makes your heap explode.

int findMyTypeXYZ( MyType[] a, int criteria ){
	int match = convCrit( criteria );
	return tango.core.Array.findIf( a, delegate bool(T e){ return e.attrib
is match; });
}

First this run without allocation, now it does allocate.
Image how this behave if called very often :(
And even worse, there is no way to manually delete the allocated stack
frames. So there is no way around the GC runs.
Finally I would end up in rewriting that code, not using a delegate
based design. But IMHO this is one of the important D features.







More information about the Digitalmars-d mailing list