Improving ThreadLocalRandom (and related classes)
Andrew Haley
aph at redhat.com
Tue Jan 8 13:43:20 UTC 2013
On 01/08/2013 12:05 PM, Doug Lea wrote:
> 1. Uniformly faster access to ThreadLocalRandom state. While
> ThreadLocal access is normally pretty fast already, this is
> not only faster, it does not degrade in cases where user
> programs create large numbers of ThreadLocals, which
> may (probabilistically) cause any given access to become
> slower.
One random thought. Linux x86 has very fast access to thread local
variables: it's just a segment prefix on a load instruction. I wonder
if the JVM could utilize something like this and so improve
performance for thread locals that don't require non-null initial
values. This would be better than piling everything into Thread's
state...
Andrew.
More information about the core-libs-dev
mailing list