Type Definition arc_swap::strategy::DefaultStrategy[][src]

type DefaultStrategy = HybridStrategy<DefaultConfig>;

The default strategy.

It is used by the type aliases ArcSwap and ArcSwapOption. Only the other strategies need to be used explicitly.

Performance characteristics

Each thread has a limited number of fast slots (currently 8, but the exact number is not guaranteed). If it holds at most that many Guards at once, acquiring them is fast. Once these slots are used up (by holding to these many Guards), acquiring more of them will be slightly slower, but still wait-free.

If you expect to hold a lot of “handles” to the data around, or hold onto it for a long time, you may want to prefer the load_full method.

The speed of the fast slots is in the ballpark of locking an uncontented mutex. The advantage over the mutex is the stability of speed in the face of contention from other threads ‒ while the performance of mutex goes rapidly down, the slowdown of running out of held slots or heavy concurrent writer thread in the area of single-digit multiples.

The ballpark benchmark figures (my older computer) are around these, but you’re welcome to run the benchmarks in the git repository or write your own.