This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 4.0.0 JNI/reflection invocation 2/4/8 times as slow as in 3.3.3

> Jost> -        table = new Object[old.length << 1 +
> 2];
> Jost> +        table = new Object[(old.length * 2) +
> 2];
> Jost> Imho the new implementation is nonsense.
> The new implementation is really just the original
> reimplementation resurrected.

Umm, no.  The original implementation is this: double
the size of the table and add 4 empty slots per

The new implementation just adds an empty slot at the
end, essentially creating a linear list with the empty
slot as the stop marker.

> I don't follow why that would be better.  Could you
> elaborate on this?

We need to retain the structure of the hash, which is:


I think the confusion comes from the misleading
comment at the top, which I think mentions that we
need an odd number of entries.  The comment is correct
(the last entry is used to separate the buckets), but
maybe it should mention how the entries are layed out.
Probably the original author wrote 1 + 2 to emphasize
that the size of the hash gets doubled and we add 4
slots per bucket. 



Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]