SwayDB icon indicating copy to clipboard operation
SwayDB copied to clipboard

Use LongAdder instead of AtomicLong for maintaining read references to a file

Open simerplaha opened this issue 4 years ago • 0 comments

Memory-mapped files currently maintain a read reference counter (AtomicLong) so that the memory-cleaner knows to clear mapped bytes only when the file is not being accessed.

Since clear is most likely to never occur or occur very rarely (only 1s) in comparison to reads, LongAdder should yield better performance.

simerplaha avatar Nov 02 '21 15:11 simerplaha