"body" keyword is unnecessary
bearophile
bearophileHUGS at lycos.com
Sat Mar 26 05:48:10 PDT 2011
Alvaro:
> A bit off-topic post:
It's not off-topic, you have shown one case where the keyword "body" is useful as variable name.
> I first hit "body" when porting the nbody benchmark test from the
> Computer Language Shootout to D.
Time ago I have translated to D (D1, mostly) all Shootout benchmarks. Here you see two versions:
http://shootout.alioth.debian.org/debian/performance.php?test=nbody
> BTW, in that benchmark D, with my clean implementation, would perform
> similar to "Clean", about 1.7x slower than the fastest, Fortran. That is
> with GDC and all optimizations. DMD a bit behind with a 2.1x elapsed
> time. Both are behind Java, C and C++.
Fortran was designed to run as fast as possible right this kind of programs.
D1 code compiled with LDC is about as fast as naive C n-body code (I have said naive version because in D you can't use intrinsics as __builtin_ia32_sqrtpd() as in one more advanced C++ version).
Bye,
bearophile
More information about the Digitalmars-d
mailing list