vorner / arc-swap

Support atomic operations on Arc itself

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance suggestions

vorner opened this issue · comments

On reddit, 0b_0101_001_1010 suggested some things to possibly improve performance, might be worth looking into:

It might make sense to store the ref count into a single cache line (e.g. using repr(align(64))) to avoid false sharing when updating the ref count but accessing the pointer, but if you are going to try this it will definetely help to have benchmarks first.

Also, you might want to look into using double CAS and a 128-bit wide atomic type in the architectures that support it. Double CAS is very expensive, and often slower, but maybe it fits your use case better.

It is already using align.

Double CAS doesn't seem to be available right now in Rust, and there doesn't seem to be an obvious place to fit it, so not doing that.