This is the mail archive of the
mailing list for the Java project.
ReRe: performance (shellsort experiments)
- To: email@example.com
- Subject: ReRe: performance (shellsort experiments)
- From: Norman Hendrich <firstname.lastname@example.org>
- Date: Tue, 17 Aug 1999 17:57:36 +0200 (MET DST)
- Cc: email@example.com
Jeff Sturm wrote:
> That's more like it! I wonder if this call could somehow be optimized
> away, if the compiler is smart enough to know that it is reassigning
> values from the same array... hmm... I wonder what happens if I replace
> "Object" with "Double" in the source and compile/run again:
> [Object sorting with _Jv_CheckArrayStore(): 59 seconds]
> [Object sorting without _Jv_CheckArrayStore(): 17 seconds]
> [Double sorting (=specific type): 16 seconds]
Interesting! I have often wondered how much runtime overhead the
'generic type' approach to data structures in Java really implied.
I would never have guessed a factor of almost four, however.
Seems that C++-style templates are worth-while after all...
(Probably, most of us will already have 'production versions' of some
java.util classes with specific types and without all the 'synchronized'
> That's it. If we help the compiler a little it can optimize away the
> the call to _Jv_CheckArrayStore().
As the above result shows, having a smart compiler that detects
this situation (reassigning an object to an array) might really help:
Object arrays are quite common idiom in Java, and many of the
classes in java.util use such arrays interally, too.