Optimizing a Spin-Lock
Summary
A detailed blog post benchmarking and optimizing a spin-lock in C++, covering naive lock variants, memory ordering, test-and-set variants, and exponential backoff. It highlights performance and energy efficiency gains across configurations and provides takeaways on when to use spin-locks versus std::mutex.