If it's used in HashMap, then I think that's a mistake as well, but I'd have to look at the exact details to know. The capacity and load factory are externalized for a reason, so that a consumer can use them to adjust the performance and resource consumptions to their needs.
I'm sure this optimization shows an improvement in the serialization use case, but you'd be hard pressed to say that this improvement will make 80% of all uses of HashMap, WeakHashMap and IdentityHashMap better. If you want to round to 2000 to improve serialization, then do that in the serialization. I don't think this should be applied as is. -Nathan On Fri, Apr 18, 2008 at 11:34 AM, Aleksey Shipilev < [EMAIL PROTECTED]> wrote: > Nathan, > > 1. Spec does not require *HashMap should be exactly of given capacity, > it's just should provide the capacity requested, which obviously right > if we are rounding to next 2^k. This parameter is merely a hint to > collection on what size it should be ready to, nobody could (or > should) guarantee the exact map capacity, it does not visible from > outside, it's all implementation business. > > 2. This hint can dramatically improve the performance of *HashMap, as > demonstrated on benchmarks. This solution is already used to boost the > performance of j.u.HashMap. > > What do you think? > > Thanks, > Aleksey. > > On Fri, Apr 18, 2008 at 8:13 PM, Nathan Beyer <[EMAIL > PROTECTED]<https://mail.google.com/mail?view=cm&tf=0&[EMAIL PROTECTED]>> > wrote: > > https://issues.apache.org/jira/browse/HARMONY-5718 > > > > Again, I don't agree with the capacity rounding in the patch attached > to > > this issue. I do like the change to the internal data structure; use > two > > arrays for key/value instead a single array. It makes the code easier > to > > read. > > > > > > -Nathan > > > > On Fri, Apr 18, 2008 at 1:50 AM, Aleksey Shipilev < > > [EMAIL PROTECTED]<https://mail.google.com/mail?view=cm&tf=0&[EMAIL > > PROTECTED]>> > wrote: > > > > > > > > > Colleagues, > > > > > > I had recently filed two JIRAs with improvements in Collections, > > > giving up to +30-40% to serialization benchmarks. Presumably they > will > > > boost the performance across the all users since the optimization is > > > pretty general: > > > https://issues.apache.org/jira/browse/HARMONY-5761 > > > https://issues.apache.org/jira/browse/HARMONY-5718 > > > > > > Would some classlib guru (Tim, Nathan, Tony?) review and commit them? > > > > > > Thanks, > > > Aleksey. > > > > > >
