wvwwvwwv / scalable-concurrent-containers

High performance containers and utilities for concurrent and asynchronous programming
Apache License 2.0
306 stars 15 forks source link

Use compare_exchange_weak in a few simple places #92

Closed novacrazy closed 1 year ago

novacrazy commented 1 year ago

On arm/aarch64 (and possibly other targets), compare_exchange (_strong) will effectively generate an additional check loop on top of compare_exchange_weak codegen. As spurious failures are relatively uncommon, we may as well combine those loops in code if they don't do too much work to setup the new value.

On x86, the codegen should be exactly the same.

wvwwvwwv commented 1 year ago

Thanks, looks great!