www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Threadpools, difference between DMD and LDC

I'm trying to grok message passing. That's my very first foray 
into this, so I'm probably making every mistake in the book :-)

I wrote a small threadpool test, it's there:


I'm playing with the number of threads and the number of tasks, 
and getting a feel about how message passing works. I must say I 
quite like it: it's a bit like suddenly being able to safely 
return different types from a function.

What I don't get is the difference between DMD (I'm using 2.065) 
and LDC (0.14-alpha1).

For DMD, I compile with -O -inline -noboundscheck
For LDC, I use -03 -inline

LDC gives me smaller executables than DMD (also, 3 to 5 times 
smaller than 0.13, good job!) but above all else incredibly, 
astoundingly faster. I'm used to LDC producing 20-30% faster 
programs, but here it's 1000 times faster!

8 threads, 1000 tasks: DMD:  4000 ms, LDC: 3 ms (!)

So my current hypothesis is a) I'm doing something wrong or b) 
the tasks are optimized away or something.

Can someone confirm the results and tell me what I'm doing wrong?
Aug 03 2014