How fast is D compared to C++?
问题 I like some features of D, but would be interested if they come with a runtime penalty? To compare, I implemented a simple program that computes scalar products of many short vectors both in C++ and in D. The result is surprising: D: 18.9 s [see below for final runtime] C++: 3.8 s Is C++ really almost five times as fast or did I make a mistake in the D program? I compiled C++ with g++ -O3 (gcc-snapshot 2011-02-19) and D with dmd -O (dmd 2.052) on a moderate recent linux desktop. The results