lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven A Rowe" <sar...@syr.edu>
Subject RE: [jira] Created: (LUCENE-1257) Port to Java5
Date Wed, 09 Apr 2008 12:16:04 GMT
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message