Brian Jones wrote:
Before we've said we preferred correctness over optimization every
time and it is well known that optimizing too early can reduce the
effectiveness of certain JVM implementations that will do it for you.
Perhaps using an Iterator and hasNext() with no reliance on size() is
better all around and just leave optimization to the VM?

I agree with this general sentiment (of course - it's the one I've been arguing for :) )


I do think that certain optimizations are worthwhile and can't be done by the VM - for example preallocating the "probably-right" size of array in Vector and ArrayList rather than repeatedly growing it as necessary. I don't think we should just blindly remove all optimization. But I do think that the use of size() as an optimization over hasNext() is taking optimization too far - especially as there's no guarantee that size() really is faster for all collections.

Stuart.

--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net



_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to