Sam Hu wrote:
bearophile Wrote:
I have tried the new JavaVM on Win, that optionally performs escape analysis,
and the results are nice:
Timings, N=100_000_000, Windows, seconds:
D 1: 40.20 DMD
D 2: 21.83 DMD
D 2: 18.80 DMD, struct + scope
C++: 18.06
D 1: 8.47 DMD
D 2: 7.41 DMD + scope
Java: 1.84 V.1.6.0_14, -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
Java 1.78 -server
Java: 1.44
Java: 1.38 V.1.6.0_14
Java: 0.28 V.1.6.0_14, -server -XX:+DoEscapeAnalysis
Timings, N=100_000_000, Pubuntu, seconds:
D 1: 25.7 LDC
C++: 6.87
D 1: 2.67 LDC + scope
Java: 1.49
Bye,
bearophile
Sorry for my stepping in...
What does this result mean?Does it mean D is slower than Java and C++ is also
slower than Java?Or that's true just under certain circumstance?
I am really confused and really appreicate if any further explanation.
Regards,
Sam
It suggests that for dynamic allocation of many small objects via "new",
Java is an order of magnitude faster than C++, which in turn is slightly
faster than D.