classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [really patch] Re: HashMap putAll/putAllInternal bug


From: Stuart Ballard
Subject: Re: [really patch] Re: HashMap putAll/putAllInternal bug
Date: Tue, 30 Sep 2003 14:26:32 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]