Hmm reading code i verified that i can gain a 10% writing:

                    imd dSquared = sqrt(dx ^^ 2 + dy ^^ 2 + dz ^^ 2);
                    imd mag = dt / (dSquared * dSquared^^2);

Around line 115. Give it a try... 

Il giorno gio, 24/11/2011 alle 22.37 -0500, bearophile ha scritto:

> This is the nbody benchmark of the Shootout site:
> http://shootout.alioth.debian.org/u32/performance.php?test=nbody
> 
> The faster version is a Fortran one, probably thanks to vector operations 
> that allow a better SIMD vectorization.
> 
> This is the C++ version:
> http://shootout.alioth.debian.org/u32/program.php?test=nbody&lang=gpp&id=1
> 
> C++ version compiled with:
> g++ -Ofast -fomit-frame-pointer -march=native -mfpmath=sse -msse3 --std=c++0x
> An input parameter is n= 3_000_000 (but use a larger number if therun time is 
> too much small, like 10 millions or more).
> 
> First D2 version (serial):
> http://codepad.org/AdRSm2wP
> 
> Second D2 version, three times slower thanks to vector ops, more similar to 
> the Fortran version:
> http://codepad.org/7O3mz9en
> 
> Is someone willing to take two (or more) timings using LDC 2 compiler (I have 
> LDC1 only, beside DMD)? I'd like to know how much time it takes to run the 
> first D version *compared* to the C++ version :-) If you time the second D2 
> version too, then it's better.
> 
> Bye and thank you,
> bearophile

Reply via email to