flare icon indicating copy to clipboard operation
flare copied to clipboard

SyncMap Custom Implementation

Open vectrixdevelops opened this issue 3 years ago • 0 comments

The sync map provides a flexible way to wrap any map implementation and make it thread safe. However, it does suffer from some performance loss due to it's flexible design which may be undesirable in situations where lock contention can range from nothing to low contention (and possibly more). While achieving speeds relative to a ConcurrentHashMap#get and others under low contention may vary, it could be possible to close the gap more, by added a new custom backing implementation to SyncMap and store the data in buckets, similar to a ConcurrentHashMap, with instead of one lock for the whole map, a lock for each bucket. This could also be repeated for custom fastutil implementations too (although it may be trickier). If done correctly, it could result in speeds close to ConcurrentHashMap and higher.

More effort would need to be put in to evaluate the direction here, but it could be a good avenue to go.

vectrixdevelops avatar Oct 09 '21 03:10 vectrixdevelops