Java > Scala

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 3 12:53:39 PST 2011


On Saturday, December 03, 2011 12:44:55 Walter Bright wrote:
> 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.

Oh, I completely agree. I'm just saying that Java has an undeserved bad rap 
for slowness at this point given that it's quite fast in comparison to many 
languages and is often plenty fast for what most programmers do with it. It's 
when you _really_ need speed that it can't deliver.

- Jonathan M Davis


More information about the Digitalmars-d mailing list