language_fan wrote:
Sun, 20 Sep 2009 18:16:37 -0400, bearophile thusly wrote:
My benchmarks aren't chosen randomly, I naturally focus on things that
are slower in D, so sometimes you can see Java to "win". I usually
discard the code where Java results slower :-)
I have seen people many times mention that Java is in general orders of
magnitude slower than D, no matter what kind of algorithms you run on
both environments.
I think you're creating a straw man. I don't recall anyone saying that.
Certainly not "orders of magnitude" in general.
In general, when D is faster, it'll be because more coding techniques
are available. For example, because you're not forced to used OOP all
the time.
This is because of the VM - nothing on a VM can run
faster than native code, they say. If you decide to hide the bad results
(for D), it will only reinforce the misinformation. I personally use a
lot of heap memory allocation in my work, and so far Java has not only
been safer (and provides decent stack traces and no compiler bugs), but
also faster - each time.
On this ng, it seems to be universally acknowledged that Java's GC is
much better than D's; and that Java's tool chain is orders of magnitude
more mature than D.
But, in the cases where Java beats D, it will almost always be because
of the GC. LDC probably only gets beaten on the GC.
Having looked at the DMD optimiser, I'm a bit surprised that it's
competitive at all (especially in floating point). There is so much
low-hanging fruit, it's practically an orchard <g>. It's hardly been
touched since the mid-90's, while Java's had 15 years of massive
commercial development during that time.