No. C will typically be about 5-10 times faster than the same application
written in Java, if the bottleneck is in code written in those languages.
That's an important point, because often the bottleneck is the rasteriser on
the grapj=hics card or something similar, in which case C will have no
advantage.
In my (admittedly limited, but more than zero) experience, C
is indeed faster, but not by anything like a factor of 5 to 10.
I'm curious to know what kinds of applications, on what systems,
exhibit such dramatic differences. I just did a quick check
using a toy numerical-integration example for a class I teach,
and the Java version took about 2.9 seconds, while the C version
took about 1.6 seconds. This is on a reasonably fast Intel-based
desktop-class machine running Linux, gcc, and Sun's Java. One of
my colleagues has done a couple of C++-versus-Java performance
comparisons using real code, and while the C++ versions are
invariably faster, the slowdown for the Java versions is usually
on the order of 10 to 25 percent (e.g., if the C++ version takes 1
minute, the Java version takes 1.1 to 1.25 minutes). There was one
exception -- a program that makes extensive use of trig functions,
which in Java are apparently (sometimes?) implemented in a way
that emphasizes portability over performance, or something. Now,
that's C++ and not C, but I have the impression from another
recent discussion in this group that C and C++ give comparable
performance.
Not saying you're wrong, Malcolm, just wondering why your
experience seems so different from mine. Early implementations
of Java were indeed quite slow, but my understanding is that most
current implementations do just-in-time compilation to native code,
and the results are pretty good.
However it rarely matters on modern PCs. The screen now usually updates
within a frame, so for any interactive work either Java or C is acceptable.
This is of course a good point!