Java 1.5 Speed improvements?

[quote]Right, thought I might have misunderstood the spec :slight_smile:
Kev
[/quote]
c.f. :

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=Offtopic;action=display;num=1076191147;start=0#1

Hm, according to the guy that designed .net, the way that Java is doing generics is just like what I thought it was doing after all :frowning: (That is, using only one class implementation that works with Objects and then inserting casts behind-the-scenes for you all over the place). Damn.

Cas :slight_smile:

I’m likin 1.5, but is there a reasonable estimate on when a final release will be available (based on past releases or pure speculation or possibly astrological signs…)?

[quote](That is, using only one class implementation that works with Objects and then inserting casts behind-the-scenes for you all over the place)
[/quote]
The C# architect may be right that this is bad for reflection purposes, but I really think the performance of casts is a non-issue.

My experience from optimizing code is that object-type casts done using the 1.4+ JVMs don’t affect the performance at all. Now, the auto-boxing on the other hand…

I had a think about autoboxing and where it’s being used. It certainly won’t make anything slower than it already is. But I did wonder exactly how a generic HashMap (for example) would manage to call hashCode() on float. I suppose there’s some hackery going on behind the scenes.

Cas :slight_smile:

[quote]I had a think about autoboxing and where it’s being used. It certainly won’t make anything slower than it already is. But I did wonder exactly how a generic HashMap (for example) would manage to call hashCode() on float. I suppose there’s some hackery going on behind the scenes.
[/quote]
A List isn’t a valid type in Java. You can’t use primitive data types as arguments for generic type expressions. The valid variant is List. This stores ordinary Float objects and Float#hashCode is a well known method. No magic involved :wink:

(BTW, HashMap is of course illegal, the generic type HashMap<K,V> requires two arguments)

Yeah, sorry, slightly duff example. But in C# you can have a HashMap<float,float> - that’s what I’m getting at. They actually generate their bytecodes on the fly and instantiate a brand new class, and allow primitive types as generic parameters.

Cas :slight_smile: