On 10.05.2013, at 16:17, Doug Lea <d...@cs.oswego.edu> wrote: > On 05/09/13 10:19, Peter Levart wrote: >> Hi Aleksey, >> >> Wouldn't it be even better if just threadLocalRandom* fields were annotated >> with >> @Contended("ThreadLocal") ? >> Some fields within the Thread object are accessed from non-local threads. I >> don't know how frequently, but isolating just threadLocalRandom* fields from >> all >> possible false-sharing scenarios would seem even better, no? > > As it turns out, no. Nearly all other fields of class Thread > are also modified mainly by or only by the current thread > (at least after initialization). So the simplest solution > seems to be the best one.
+1. Although I just tried what Peter had suggested, and got even more boost on my microbenchmark. This counter-intuitive for me, since no memory layout differences could explain this in my tests. I will have to untangle this today, hold on. -Aleksey