math.log() benchmark of first 1 billion int using std.parallelism

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 22 02:21:11 PST 2014


On Monday, 22 December 2014 at 10:12:52 UTC, Iov Gherman wrote:
> Now, can anyone explain why this program ran faster in Java? I 
> ran both programs multiple times and the results were always 
> close to this execution times.
>
> Can the implementation of log() function be the reason for a 
> slower execution time in D?
>
> I then decided to ran the same program in a single thread, a 
> simple foreach/for loop. I tried it in C and Go also. This are 
> the results:
> - D: 24 secs, 32 ms.
> - Java: 20 secs, 881 ms.
> - C: 21 secs
> - Go: 37 secs
>
> I run Arch Linux on my PC. I compiled D programs using 
> dmd-2.066 and used no compile arguments (dmd prog.d).
> I used Oracle's Java 8 (tried 7 and 6, seems like with Java 6 
> the performance is a bit better then 7 and 8).
> To compile the C program I used: gcc 4.9.2
> For Go program I used go 1.4
>
> I really really like the built in support in D for parallel 
> processing and how easy is to schedule tasks taking advantage 
> of workUnitSize.
>
> Thanks,
> Iov

DMD is generally going to produce the slowest code. LDC and GDC 
will normally do better.


More information about the Digitalmars-d-learn mailing list