On Apr 10, 2005, at 3:44 PM, gossamer axe wrote:
A few newbie questions here. I thought that the lower level the code, the faster it runs. So C runs faster than VB but Assembly runs faster than C. I do realize it's also the talent of the programmer.
Yes and no. I'm just really definitive today ...
Given that C and assembly compile to the same machine code, their is no "a priori" reason for one to run faster than the other.
C code will normally run faster than hand generated assembly for 99.9% of all cases. The reason is that the compiler can take a global view of resource allocation (register coloring, constants, pointers, memory access, loop unrolling, calling conventions, etc.) and make tradeoffs that a human simply cannot keep in their head. Yes, you get the occasional application where a hand-tuned assembly language loop can stomp on compiled code, but that's getting rarer and rarer.
VB, Java, Lisp, Python, et al. tend to get lumped in the slow category because they 1) tend to be interpreted and 2) tend to box and unbox variables (extra layer of indirection). I don't know about VB, but that is an invalid assumption for Java and Lisp, nowadays.
Lisp gets compiled to direct machine code for most versions of Common Lisp; it competes very favorably with C.
After a JIT (just-in-time) compiler gets done with compiling Java code to machine code, I have seen it be *faster* than comparable C. Part of this is the enforcement of non-aliasing just like in Fortran; part of this is the fact that garbage collection can improve processor cache locality.
What is Java considered? And is C a middle or low level programming language?
I consider C a low level language, today. The dividing line for me is manual memory management vs. automatic memory management/garbage collection. C++ *barely* gets a middle level classification because of the way I use automatic pointers and the STL as a pseudo-garbage collection system.
Java at least scores as a middle level programming language.
I'm not sure I score any programming language as a "high" level language.
What do you mean by poor support on Linux?
No good open-source Java ports. The open-source C# implementation (Mono) is significantly better than any of the open-source Java implementations.
The open source folks should get flogged for this. Fortunately, Java has finally found a killer app: Azureus.
Also, the OpenOffice stuff is putting some pressure on the open source Javas, too.
-a
-- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
