From a C++/JS benchmark
Denis Shelomovskij
verylonglogin.reg at gmail.com
Wed Aug 3 13:43:17 PDT 2011
03.08.2011 22:15, Ziad Hatahet:
> I believe that "long" in this case is 32 bits in C++, and 64-bits in the
> remaining languages, hence the same result for int and long in C++. Try
> with "long long" maybe? :)
>
>
> --
> Ziad
>
>
> 2011/8/3 Denis Shelomovskij <verylonglogin.reg at gmail.com
> <mailto:verylonglogin.reg at gmail.com>>
>
> 03.08.2011 18:20, bearophile:
>
> The benchmark info:
> http://chadaustin.me/2011/01/__digging-into-javascript-__performance/
> <http://chadaustin.me/2011/01/digging-into-javascript-performance/>
>
> The code, in C++, JS, Java, C#:
> https://github.com/chadaustin/__Web-Benchmarks/
> <https://github.com/chadaustin/Web-Benchmarks/>
> The C++/JS/Java code runs on a single core.
>
> D2 version translated from the C# version (the C++ version uses
> struct inheritance!):
> http://ideone.com/kf1tz
>
> Bye,
> bearophile
>
>
> Compilers:
> C++: cl /O2 /Oi /Ot /Oy /GT /GL and link /STACK:10240000
> Java: Oracle Java 1.6 with hm... Oracle default settings
> C#: Csc /optimize+
> D2: dmd -O -noboundscheck -inline -release
>
> Type column: working scalar type
> Other columns: vertices per second (inaccuracy is about 1%) by
> language (tests from bearophile's message, C++ test is
> "skinning_test_no_simd.cpp").
>
> System: Windows XP, Core 2 Duo E6850
>
> ------------------------------__-----------------------------
> Type | C++ | Java | C# | D2
> ------------------------------__-----------------------------
> float | 31_400_000 | 17_000_000 | 14_700_000 | 168_000
> double | 32_300_000 | 16_000_000 | 14_100_000 | 166_000
> real | 32_300_000 | no real | no real | 203_000
> int | 29_100_000 | 14_600_000 | 14_100_000 | 16_500_000
> long | 29_100_000 | 6_600_000 | 4_400_000 | 5_800_000
> ------------------------------__-----------------------------
>
> JavaScript vs C++ speed is at the first link of original
> bearophile's post and JS is about 10-20 temes slower than C++.
> 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.
>
>
Good! This is my first blunder (it's so easy to complitely forget
illogical (for me) language design). So, corrected last row:
Type | C++ | Java | C# | D2
-------------------------------------------------------------
long | 5_500_000 | 6_600_000 | 4_400_000 | 5_800_000
Java is the fastest "long" language :)
More information about the Digitalmars-d
mailing list