Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Josh Bloch writes: Wolfgang, Hi. The reason is that I thought that cloning the array was faster when I wrote the code. I was wrong. Unless I'm missing something, this should be fixed. I'm copying Martin Buchholz at Sun in the hopes that he'll fix it or pass it on to someone else at Sun to fix. I'm copying Neal and Doug because I think they'll be interested. Regards, Josh On Mon, 15 Nov 2004 18:11:17 -0800, Wolfgang Hoschek <###@###.###> wrote: >> Josh, >> just a quick question since you're probably busy. >> >> In java.util.Arrays.sort(Object[]) and range based cousin, to set up >> the temporary buffer array, why not simply use "new Object[size]" and >> then System.arraycopy instead of clone() or reflection in >> cloneSubArray()? My understanding is that System.arraycopy is faster >> than clone(). >> >> When frequently sorting small arrays on jdk 1.5.0 server, VM clone() >> shows up with 14% when profiling with the non-perturbing flags '-server >> -agentlib:hprof=cpu=samples,depth=10' >> >> This is with our binary xml codec: >> http://dsd.lbl.gov/nux/api/nux/xom/binary/BinaryXMLCodec.html >> >> TRACE 300256: >> java.lang.Object.clone(Object.java:Unknown line) >> java.util.Arrays.sort(Arrays.java:1219) >> nux.xom.binary.BinaryXMLCodec.packSort(BinaryXMLCodec.java:560) >> nux.xom.binary.BinaryXMLCodec.serialize(BinaryXMLCodec.java:469) >> nux.xom.tests.BinaryXMLTest.main(BinaryXMLTest.java:115) >> >> Thanks, >> Wolfgang. ###@###.### 2004-11-16 04:44:31 GMT
|