This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: 4.0.0 JNI/reflection invocation 2/4/8 times as slow as in 3.3.3
- From: Jost Boekemeier <jost2345 at yahoo dot de>
- To: tromey at redhat dot com
- Cc: java at gcc dot gnu dot org
- Date: Sun, 23 Jan 2005 20:11:47 +0100 (CET)
- Subject: 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
bucket.
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:
bucket1/slot1..n/empty1|bucket2/slot2..n/...
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.
Jost
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de