Threadpools, difference between DMD and LDC

safety0ff via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 3 15:24:21 PDT 2014


On Sunday, 3 August 2014 at 19:52:42 UTC, Philippe Sigaud wrote:
>
> Can someone confirm the results and tell me what I'm doing 
> wrong?

LDC is likely optimizing the summation:

     int sum = 0;
     foreach(i; 0..task.goal)
         sum += i;

To something like:

     int sum = cast(int)(cast(ulong)(task.goal-1)*task.goal/2);


More information about the Digitalmars-d-learn mailing list