And Windows 8 is being written to aim at… C++.
How is the C++ stuf handled in Win8? Is it going to be set up to run with .NET on the CLR?
I don’t know if “approximately zero” means 0.9 us or 0.001us or what, but since he could resolve the Java time/iter down to 0.1us, we can probably assume it means < 0.1us, so we can set a lower bound of C++ being 16x faster than Java (for this one random benchmark.) This goes to Miramon’s point about it being easy to screw up performance in C++ (though note the optimization was apparently the same one that had been done for the Java version.)
Yes, it illustrates a point pretty clearly, that you CAN make C++ faster… on the right compiler, if you take the time to deal with the micromanagement of things.
But most people don’t do that anyway. They end up writing C++ code that runs slower than Java code, while also being harder to write.
I agree with the idea that lower level languages have value in certain specific applications. But, in the grand scheme of things, most applications benefit heavily from higher level languages.
Also, from Alberto’s own page, it doesn’t appear to be 0… not sure where that number comes from. His numbers cite:
On my machine, making a loop of 10000000 iterations:
java version: 26922 milliseconds
c++ version: 21422 milliseconds
Certainly not a trivial difference, but we’re talking a difference of around 20%.
And doing so required a 30% increase in the amount of code written.
Again, it’s an illustration of the kind of tradeoffs you’re making. If you really roll up your sleeves and get under the hood, you can tune it to be faster… But if you’re just writing applications at a higher level, then you’re not likely to get much benefit from a lower level language. You’ll just get the painful aspects of it.
The benefit of using a managed language like Java is that you benefit from the fact that the guys at Sun handled most of the low level crap… and, the vast majority of the time, they probably did it much better than we can. :)