In article <55a68459-63e7-4da4-b667-1c6892b7b9d0@r24g2000yqd.googlegroups.com>, James Kanze <james.kanze@gmail.com> wrote:
On Dec 25, 7:01 pm, ta...@mongo.net (tanix) wrote:
In article
<ec7d2a9b-ee76-46b6-ae3a-587d199b6...@s3g2000yqs.googlegroups.com>,
James Kanze <james.ka...@gmail.com> wrote:
[...]
virtual machine is also heavy performance killer...
Which explains why some of the leading experts in
optimization claim that it is necessary for the best
optimization. (I don't fully buy that claim, but a virtual
machine does have a couple of advantages when it come to
optimizing: it sees the actual data being processed, for
example, and the actual machine being run on, and can
optimize to both.)
Yep. And the more high level some abstraction is, the more
performance it can gain and the less of even theoretical
advantage any other approach may claim.
More generally, the more information a compiler has, including
information concerning why some operation is taking place, the
better it can optimize. It's pretty well established that when
the language has built in bounds checking (so the compiler knows
the why of the comparisons), the compiler can generate better
code.
In the case of a VM, of course, the compiler has very exact
knowledge about the input data, the frequency of the various
paths, and the CPU it is running on. All of which are important
information. Where I have my doubts is because in a VM, the
compiler is severely limited in the time it can take for its
analysis; if an optimizing compiler takes a couple of hours
analysing all of the variations, fine, but in a VM? But since
I'm not an expert in this field, I don't really know.
And that is one of central issues with Java.
Yes.
I think java is designed in such way that it will still be
slow in comparison to other compiled languages...if it is
compiled language.
First, Java is a compiled language, and second, it's not
slower than any of the other compiled languages, globally.
(Specific programs may vary, of course.)
And that is exactly what I am seeing in my own situation.
The few measurements I've made would bear you out. I'm sure
that there are applications where C++ will be faster, and there
are probably some where Java will be faster, but for most
applications, C++ is chosen not for speed, but because it has
greater expressibility.
Interesting subject.
Not sure if it is that simple to argue this expressibility argument.