Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce contention in parallel eviction by counting opportunistically/…
…inaccurately which is acceptable... Just substract the difference and report if it's positive, as in, the count after eviction is lower, it can be higher due to overlap with a lot of insertions, in which case we can simply report 0. Ideally, we would use a spaced counter with per-core hashed offsets to prevent false sharing but that would be hard to do reliably due to enumerator.AsParallel() behavior. Don't forget that this is a naive implementation imposed by inherent limitations of ConcurrentDictionary API. It still gives significant (+2x) performance improvement on multi-core systems but is otherwise less efficient due to SPMC behavior of the underlying parallel logic.
- Loading branch information