persistence@glassfish.java.net

Re: Issue 401: Moving size() outside a for loop?

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Fri, 17 Mar 2006 21:14:39 -0800

Marina Vatkina wrote:
> Peter, Tom,
>
> There are 63 files where I found size() in the for loop (using grep,
> so obviously I need to go over each case to double check).
>
> Do you see any problem with moving all of them out of the for loop?
>
> I also saw (at least once) where the code "manually" creates an
> Object[] from a collection. Do you see a problem if I replace it
> with toArray() call?
>
> While it's a lot of changes, I can make them before Monday so that
> we can try to run them with performance benchmarks and see if it
> makes a difference.
>
> What do you think?
>
> thanks,
> -marina

Are you sure this isn't premature optimization?
You know what they say about premature optimization...