On 12/3/2011 12:33 PM, Walter Bright wrote:
It's when you take advantage of things C has to offer, like user defined value
types, pointers, etc., that C pulls way ahead.
A couple examples. Take a linked list:
struct List {
struct List *prev, *next;
...payload...
};
We can do that in Java:
class List {
List prev;
List next;
...payload...
}
Right? But hidden in the Java class are two extra entries, a pointer to the
vtbl[] and a mutex. Every one of the Java List instances is going to consume 8
more bytes than the C version. Consuming more memory has performance costs. No
Jit I know of can fix that.
Secondly, consider the small string optimization that is common in C. Can't do
it in Java, and no credible Jit technology can fix that, either.