RFR JDK-7143928 : (coll) Optimize for Empty ArrayList and HashMap (original) (raw)

Martin Buchholz martinrb at google.com
Tue Apr 2 18:33:41 UTC 2013


On Tue, Apr 2, 2013 at 11:24 AM, Mike Duigou <mike.duigou at oracle.com> wrote:

On Apr 2 2013, at 10:55 , Martin Buchholz wrote: > Thanks for the research. > It seems like hotspot is recognizing and optimizing fill loops, rather than > intrinsifying calls to Arrays.fill itself (good!). Why wouldn't doing both be better? If hotspot recognizes and optimizes fill loops, Arrays.fill is optimized "for free".

> Anyways, I'd still like the "simple" fill loops in ArrayList to stay > unchanged. Using Arrays.fill is only slightly more readable.

Part of the goal of the change was to make the intent clearer. I'll improve the comments instead.

ArrayList is one of those classes that are important for educational reasons. Studying it will be part of many peoples' university education. So I applaud efforts to improve clarity. But I think the fill loops are sufficiently clear as they stand.



More information about the core-libs-dev mailing list