On Thursday, 28 February 2013 at 14:15:57 UTC, Joseph Rushton Wakeling wrote:

In other words, it doesn't seem possible to get more than about 2 * speedup on my system from using concurrency, even though there should not be any data races or other factors that might explain slower performance.

I've just run your example with DMD 2.061 on an Intel Core2 Quad (Q8200 @ 2.33 GHz) and got 36 s in sequential mode and 11-12 s in parallel (n=4). So it's ~3x speedup.

Two ideas coming to mind:
1) Amdahl's law. If there is some locking inside random numbers generator, you will never get linear speed up. 2) More probable: the "4 cores" of your laptop might be just 2 cores with hyperthreading, that's not honest 4 cores, they won't give you 4x speedup anywhere.

Reply via email to