N-body bench

Stanislav Blinov stanislav.blinov at gmail.com
Thu Jan 30 06:17:15 PST 2014


Ok, didn't need to wait for the weekend :)

Looks like both dmd and ldc don't optimize slice operations yet, 
had to revert to loops (shaved off ~1.5 seconds for ldc, ~9 
seconds for dmd). Also, my local pull of ldc had some issues with 
to!int(string), reverted that to atoi :)

Here's the code:

http://dpaste.dzfl.pl/4b6df0771696

C++ version compiled with the provided flags.

dmd -release -O -inline -noboundscheck

ldc2 -release -O3 -disable-boundscheck -vectorize -vectorize-loops

Here are the results on my machine (i3 2100 @3.1GHz):

time ./nbody-cpp 50000000:
-0.169075164
-0.169059907
0:05.20 real, 5.18 user, 0.00 sys, 532 kb, 99% cpu

time ./nbody-ldc 50000000:
-0.169075164
-0.169059907
0:07.84 real, 7.82 user, 0.00 sys, 1324 kb, 99% cpu

time ./nbody-dmd 50000000:
-0.169075164
-0.169059907
0:23.35 real, 23.29 user, 0.00 sys, 1184 kb, 99% cpu



More information about the Digitalmars-d-learn mailing list