static array litteral syntax using a library solution (no GC and 40x faster!)

Max Klyga email at domain.com
Sun Feb 3 07:16:48 PST 2013


On 2013-02-03 13:18:03 +0000, John Colvin said:

> On Sunday, 3 February 2013 at 09:23:01 UTC, timotheecour wrote:
>> snip
> 
> Very interesting! Anything that beats c performance is a very big plus for D.
> 
> Btw,  you can replace the loop in S with
> ret[] = a[];
> Which should be even faster.
> 
> Also, to check that the assignment is being optimised away,  try using 
> different data in each pass.

It will not get faster, not only that. It will not even compile.

If look carefully, you will notice that it is in fact a static foreach 
and a is not an array, but a tuple, so the whole loop is unrolled as a 
series of assignments (ret[0] = a, ret[1] = b …)



More information about the Digitalmars-d mailing list