Is java really faster than c++?

I read this article and it seems that java is faster than c++, i'm asking why.

The real bottleneck is the memory management, java version allocates some Mb at satartup then reuse that memory, the c++ version allocates and deallocates the memory instantly.
So i was guessing why not to write a c++ version that reuse the memory just allocated.

This code is not written for elegance or security or whatever is simply a test in order to see if the memory result achived whit java is comparable with c++.
I added 21 lines of code.

On my machine, making a loop of 10000000 iterations:
java version: 26922 milliseconds
c++ version: 21422 milliseconds

I think that we can go faster rewriting the code, but I only want to simulate the java memory model.
That's the changes I have made c++ code: get it
This is all modified version c++ code: get it
This is a friendly win/vs2005 c++ version code: get it


Back to homepage

Number of times his page has been visited since August 18, 2008:
Powered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounterPowered by PHPCounter