From a C++/JS benchmark
bearophile
bearophileHUGS at lycos.com
Wed Aug 3 14:56:00 PDT 2011
Denis Shelomovskij:
> (tests from bearophile's message, C++ test is "skinning_test_no_simd.cpp").
For a more realistic test I suggest you to time the C++ version that uses the intrinsics too (only for float).
> Looks like a spiteful joke... In other words: WTF?! JavaScript is about
> 10 times faster than D in floating point calculations!? Please, tell me
> that I'm mistaken.
Languages aren't slow or fast, their implementations produce assembly that's more or less efficient.
A D1 version fit for LDC V1 with Tango:
http://codepad.org/ewDy31UH
Vertices (millions), Linux 32 bit:
C++ no simd: 29.5
D: 27.6
LDC based on DMD v1.057 and llvm 2.6, ldc -O3 -release -inline
G++ V4.3.3, -s -O3 -mfpmath=sse -ffast-math -msse3
It's a bit slower than the C++ version, but for most people that's an acceptable difference (and maybe porting the C++ code to D instead of the C# one and using a more modern LLVM you reduce that loss a bit).
Bye,
bearophile
More information about the Digitalmars-d
mailing list