Hi David, On Tue, 2005-07-12 at 08:06 -0400, David P Grove wrote: > So, I'm having a hard time seeing how this "optimization" actually makes > the code faster under any reasonable assumptions of what an optimizing JIT > is going to do. It seems mostly harmless to have it (although it makes > the method larger, and thus a slightly less attractive candidate for > inlining), but if it actually buys you any measurable speedup on a "high > performance" VM, then you should really take a hard look at your VM/JIT > and find out why they didn't do a good job on the "unoptimized" version in > the first place. clone() on an array is just a short hand for a new > followed by an arraycopy, and the new followed by arraycopy idiom shows up > all over the place so you need to do a good job on it.
I hear you :) "Don't do performance hacks without actual benchmarking." I admit to have only done some quick tests on a none-"high performance" runtime (jamvm). And the numbers seemed to indicate that this special case was triggered a lot, so I just assumed it would be beneficial in general. Unfortunately I didn't have a working setup of jikesRVM and kaffe and gcj both have a slightly different implementation of this method. The reason I thought no "reasonable" optimizing JIT could actually optimize this even with the call to arraycopy was because it cannot know that when count == value.length then offset == 0 so no bounds-checks are needed. So hand-optimizing that case into a array.clone() seemed like a win. It would be interesting to see the actual code produced by JikesRVM before and after this "optimization" for this method. Ideally we would have a dedicated benchmark box and run free software benchmarks on it comparing CVS from day to day. I had wanted to set something up like that using DaCapo. Unfortunately the box I wanted to use is actually a multi-user/server machine, so that wouldn't generate reliable results. And DaCapo isn't actually free software, even though it is build from all kinds of real world free software programs and libraries (we had some discussions about that, but when I found out I didn't actually have a box to run it on I dropped the issue.). There is the Ashes Suite Collection though which we could use. Cheers, Mark
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath