Hi Alvin,
Good to hear from you with that great question. And hello to Pradeep, who points out that
some new features (primarily auto-boxing/unboxing) take cycles at run time.
As people may know, boxing is a convenience feature that automatically converts
between a primitive type (like int) and its corresponding wrapper type (java.lang.Integer)
when the context demands it. It is there to make it easier and quicker to write code like:
Instead of l.add( new Integer(36) );
But those wrapping operations don't go away just because the programmer doesn't have to
write them any longer. The compiler actually inserts them implicitly for you. So it costs the
same as before, but you just don't see it.
How much does it cost? I have a small section devoted to that on p56 called "Performance
Implications of AutoBoxing".
Now, looking at the other side of the equation, there have been some stunning improvements
in desktop speed introduced with Java 5. I am thinking here of class data sharing. This
technique was originally developed by Apple for their Java compiler (and have you noticed how
much innovation of all kinds takes place in Apple? Keep your eye on *that* ball!).
This technique maps most of the run time library into the JVM as a single memory image
rather than a series of loads of class files. Memory mapped I/O is the fastest kind of I/O there
is, but it is not widely used outside systems programmers, probably because a lot of
application programmers are not yet familiar with the API. This technique (memory mapped
IO for the run time library) doesn't take any work on the part of application programmers
but we will all see the benefit with faster Java start-up times.
I am very anxious to see the benchmarks for the final version of Java 5, shipping tomorrow
if all goes well. I think we will see some real speed-ups for desktop apps. I use that excellent
Karsten Lentzsch Java freeware JDiskReport ALL the time. You can find it at:
http://www.jgoodies.com/index.html That is quality software written by a real Java expert. It will be interesting to see how
the performance improves with Java 5!
Cheers,
Peter