3 ms·
I played with per-thread counters. The problem is you don't want them sharing a cache line, so having them inside the object is problematic. Having external per
by vnorilo 7y ago
I played with per-thread counters. The problem is you don't want them sharing a cache line, so having them inside the object is problematic. Having external per-thread counter arrays involves bookkeeping and indirection I could not make fast enough. YMMV, and maybe someone has done a better job.
A known variant is deferred counting, where a single thread mutates refcounts and you have per-thread lightweight queues from other threads to the mutator.