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
Am Freitag, 28. Januar 2005 06:34 schrieb Ranjit Mathew:
> BTW, why is our default capacity 21 and not a prime
> like (say) 19 or 23? Primes are much better for hash
> table sizes (again, refer to TAOCP Vol. 3).
>
> On each expansion, instead of going for just 2n+1, we
> should go for the nearest prime to 2n. This is not
> as bogus as it sounds as we can easily pre-compute and
> store the 26 or so primes that would be needed for a
> default starting of, say, 23. Note that the array
> length is capped at 2^31.
>
> If the user supplies an explicit expectedMaxSize, we
> can still choose the nearest larger prime from our
> table.
>
> Thoughts?
I tried to do this for the hash tables in java/lang/natString.cc and
java/lang/natReference.cc. My profiling don't showed an improvement
but I'm sure I did something wrong. It should clearly be. Someone
should look into these too.
Michael
--
Homepage: http://www.worldforge.org/