there is absolutely no way java can be
faster then c++, in the specialised case.
secondly, the code on the site is not even
well-written, nor does it include the actual
timing code that he has implemented ...
consider this, 'fibo', from the c++ version:
Code:
if (n < 2)
return(1);
else // useless else
return(fib(n-2) + fib(n-1));
and the 'else' is left out of the java version:
Code:
if (n < 2) return(1);
return( fib(n-2) + fib(n-1) );
, despite this - the original comment stands - there
is absolutely no possibility for java to beat c++ in a
specialised case.
that said, i prefer developing in java.