Sam Hu wrote: > 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.
These are the timings for using dynamic memory allocation: >> D 1: 40.20 DMD >> D 2: 21.83 DMD >> C++: 18.06 >> Java: 1.38 V.1.6.0_14 Java is the fastest by a large margin because it has the benefit of a moving garbage collector. This means allocation is a simple pointer bump and deallocation is completely free. The slow aspects of this garbage collector (detection and preservation) aren't really tested by this benchmark. These are the timings without dynamic memory allocation: >> D 1: 8.47 DMD [+ scope] >> D 2: 7.41 DMD + scope >> Java: 0.28 V.1.6.0_14, -server -XX:+DoEscapeAnalysis D's performance is unexpectedly bad, so much that I expect that it might be using dynamic memory allocation anyway despite the 'scope' keyword. Java is clever in that it eliminates unnecessary dynamic memory allocations automatically. C++ is notable absent, but I fully expect it to outperform Java by a significant margin. -- Rainer Deyke - rain...@eldwood.com