D vs Java

Sean Kelly sean at f4.ca
Sun Mar 19 21:05:16 PST 2006


Walter Bright wrote:
> "Dave" <Dave_member at pathlink.com> wrote in message 
> news:dvkbvk$2hn5$1 at digitaldaemon.com...
>> IIRC, there was some argument a while back that they weren't running the 
>> tests
>> long-enough to take advantage of Hotspot. Since then they've increased the
>> length of the tests to account for that (and startup time is subtracted 
>> from
>> those results as well, I believe).
> 
> I attended a seminar at SDWest which talked about the "myth" of slow Java. 
> Turns out, the code is interpreted for a while, then it gets compiled, then 
> certain things can *invalidate the compiled code* so it goes back to 
> interpreting it, then compiling it again, etc.
> 
> Is it invalid to include all these compile times, even if they occur well 
> into the execution, as part of the benchmark time?

Not at all.  In fact, a similar issue came up during the C++/C#/Java 
template comparison that Herb Sutter did.  Someone said they'd heard C# 
was faster than C++, and Herb felt honor bound to respond.  The gist of 
Herb's response was this: he said that C++ was heavily optimized at 
compile time and since C++ has been around for quite a while, we've 
gotten quite good at optimizing it.  C#, on the other hand, is hardly 
optimized at all at compile time, and since the JIT process needs to be 
near instantaneous to avoid run-time stutter, almost no optimizations 
take place during run-time compilation as well.  Assuming that Java is 
similar to C# in this respect (which seems quite likely), I would be 
skeptical of any claims that Java could out-perform C++, as they have 
similar semantics and C++ is far more heavily optimized.  If Java could 
make one performance claim over C++ it would be that manipulating 
references could be more efficient than passing copies, but D could make 
the same claim... and can also take advantage of the optimizations that 
contribute the performance of C++.


Sean



More information about the Digitalmars-d mailing list