Re: [PATCH] Performance bug in String(byte[],int,int,Charset)

2008-01-08 Thread Martin Buchholz
The slowness of array.clone() has been fixed as of jdk6 and 5.0u6. 6428387: array clone() much slower than Arrays.copyOf http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6428387 The rest of this message is the latest version of my private microbenchmark to measure the fix: import java.util.*;

Re: Proposal for improving performance of TreeMap and others

2008-01-08 Thread charlie hunt
It's likely what you are observing in #2 & #3 and possibly in #1 also is an artifact of inlining and possibly other JIT (dynamic) compiler optimizations. You might consider re-running your experiment with inlining disabled, -XX:-Inlining. Or, alternatively try running your experiment (with i

Re: Proposal for improving performance of TreeMap and others

2008-01-08 Thread cowwoc
That's good news, I guess ;) because in my minimal testcase that had nothing to do with TreeMap it looked like using a Comparator to wrap natural ordering degraded performance by an order of magnitude... which is really bad :) If the same isn't true for the actual TreeMap this change might

Re: [PATCH] Performance bug in String(byte[],int,int,Charset)

2008-01-08 Thread Clemens Eisserer
Hello again, > By the way, using clone() seams better than Arrays.copyOf() here. > > byte[] b = ba.clone(); Why? I remember that I've seen some benchmarks where array.clone() was way slower than creating a new array and using System.arraycopy() (which is exactly what copyOf does). However this ma