So the method 'roundTo2k' is incorrectly named, then? Should it be
'roundTo2ToTheK'? Isn't there a Math method that should be used to do this,
which in turn should be the focus of optimization? I'd rather see such a
"general" optimization pushed into Math and then have all of the XHashMap
implementations use the Math methods consistently.
Nathan
On Fri, Apr 18, 2008 at 11:51 AM, Aleksey Shipilev <
aleksey.shipilev@gmail.com> wrote:
> Nathan,
>
> I think we have a sort of misunderstanding here. I'm not rounding to
> 2000, rather I round to next power of 2. I'm pushing the idea that
> this optimization is general because it moves longlatency modulo (%)
> operations to really cheap mask (&), but to guarantee this, we should
> guarantee the storage is 2^k, where k is 0..N.
>
> Thanks,
> Aleksey.
>
> On Fri, Apr 18, 2008 at 8:44 PM, Nathan Beyer <ndbeyer@apache.org<https://mail.google.com/mail?view=cm&tf=0&to=ndbeyer@apache.org>>
> wrote:
> > 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
> >
>
