Hi Toke, On 04/09/2008 at 2:43 AM, Toke Eskildsen wrote: > On Tue, 2008-04-08 at 18:48 -0500, robert engels wrote: > > That is opposite of my testing:... > > > > The 'foreach' is consistently faster. The time difference is > > independent of the size of the array. What I know about JVM > > implementations, the foreach version SHOULD always be faster - > > because the no bounds checking needs to be done on the > > element access... > > As for your test-code, then it does not measure performance in a fair > way, as the foreach runs after the old-style loop. I'm sure you'll see > different results if you switch the order of the two tests.
My first try at a test looked like Robert's, and exactly as you say, Toke, when operating on the same array, the first loop is slower and the second one is faster. Steve --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]