-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Most operations we do are actually incrementing counters. This should be as fast as possible, which is Arc<AtomicUsize>
.
Other operations can be slower as they happen much more rarely.
In order to achieve this, DashMap should be replaced with a shared mutable tree implementation for prodash::tree
, which is Send + Clone
(but doesn't have to be sync). If the new implementation happens to be sync, which it could be, we can consider making this a property of prodash
, which previously was a bit inconvenient as it forced users sometimes to wrap tree items into a mutex themselves.
Doing this naturally affects a lot of code especially in the renderers and it would be wise to figure out which steps to take to make this more gradual.
Benchmark Results
When using an Arc<AtomicUsize>
compared to the current dashmap based implementation.
time: [34.193 ns 34.199 ns 34.206 ns]
thrpt: [146.17 Melem/s 146.20 Melem/s 146.23 Melem/s]
change:
time: [-90.711% -90.674% -90.626%] (p = 0.00 < 0.05)
thrpt: [+966.81% +972.27% +976.50%]
Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
2 (2.00%) low severe
3 (3.00%) high mild
8 (8.00%) high severe