rust-analyzer / countme

Apache License 2.0
18 stars 4 forks source link

Make this fast #9

Open matklad opened 3 years ago

matklad commented 3 years ago

count me is extreeeemly slow under contention. This is expected, becaues the current imple is roughly loop { be_slow() }.

We should make it faster.

I see two approaches:

Use therad-local hash maps, which are registered with a global map on thread creation (Arc/Weak). I think this is possible with the current API. Must not regress single thread perf though!

Back each variable by atomic relaxed counter. This I think would need an FastCount type and fast_count! macro.

See also https://arxiv.org/abs/1701.00854

crazymerlyn commented 2 months ago

Should this be closed now or are there still low hanging fruits remaining to make this faster?