Libcuckoo and the Death of Hardware Transactional Memory
Published: November 30, 2026
When Intel Killed TSX, It Took Libcuckoo's Performance With It
There's a type of software failure that nobody talks about in architecture reviews. It's not a bug. It's not a design flaw. It's not technical debt. Your software is correct, well-tested, and performs exactly as designed — and then the hardware it was designed for gets pulled from the market. Not deprecated, not phased out. Killed. Via a microcode update that ships silently through your OS's package manager.
This is what happened to libcuckoo, and it's a story worth telling because the same thing is happening right now to other codebases sitting in production, quietly getting slower every time someone approves a firmware update.
The Paper: 2014
In April 2014, researchers from Princeton, Carnegie Mellon, and Intel Labs presented a paper at EuroSys titled "Algorithmic Improvements for Fast Concurrent Cuckoo Hashing." The headline number was impressive: almost 40 million inserts and over 70 million lookups per second on a 4-core Haswell i7-4770. The hash table used cuckoo hashing with two candidate buckets per key, breadth-first-search eviction, and — critically — Intel's brand-new Transactional Synchronization Extensions.
TSX was the star of the show. Introduced with Haswell in June 2013, it let the CPU speculatively execute a critical section without actually acquiring a lock. If no other thread touched the same cache lines during the transaction, it committed atomically. If there was a conflict, it aborted and fell back to a traditional lock. For a hash table with fine-grained access patterns and short critical sections, this was nearly ideal — the common case (no contention) paid almost zero synchronization overhead.
The paper was honest about what happened without TSX. Their fine-grained spinlock implementation was "up to 20% slower than the TSX-optimized version." They tested both paths and published both numbers. They even acknowledged that "the basic optimistic cuckoo hash table scales poorly for a write-heavy workload" when using the non-TSX path.
The Open-Source Library: Also 2014
Three months before the EuroSys conference, in January 2014, Manu Goyal pushed the initial commit of the open-source libcuckoo library. The code used fine-grained striped spinlocks. std::atomic_flag with test_and_set(memory_order_acquire) for lock, clear(memory_order_release) for unlock. The standard pattern.
TSX was never in the open-source code. The paper described TSX as an optimization and showed benchmarks with it, but the public library shipped only the spinlock fallback path. The README linked to both papers (NSDI 2013 and EuroSys 2014) but didn't mention that the performance numbers in those papers required hardware that the library itself didn't use.
This is a subtle but important gap. If you read the paper and then git clone the library expecting 40M inserts/sec, you're going to be disappointed. You'd get the spinlock path, which the paper showed was meaningfully slower. But in 2014, this was a reasonable decision — TSX was new, not universally available, and the spinlock path still scaled well on the hardware of that era.
The First Death: August 2014
Four months after the EuroSys paper was published, Intel announced a bug in TSX. Under "a complex set of internal timing conditions and system events," TSX could cause unpredictable system behavior. The bug was discovered during a diploma thesis at the National Technical University of Athens.
Intel disabled TSX via microcode update on all Haswell, Haswell-E, Haswell-EP, and early Broadwell processors. The same Haswell i7-4770 that the paper benchmarked on had its TSX silently turned off. Anyone running libcuckoo on that hardware was now on the spinlock path — and had been since the beginning, since the library never shipped TSX code anyway.
A fix arrived in November 2014 with the Broadwell F-0 stepping, but only for the vPro-enabled Core M-5Y70. TSX came back more broadly with Skylake in 2015.
The Library Evolves: 2014-2019
Between 2014 and 2019, libcuckoo saw steady development. The locking infrastructure was refactored multiple times — lock arrays replaced with lazy arrays (2016), containers introduced to manage locking (2016), lock arrays restructured into linked lists of lock containers (2017), and lazy rehashing implemented to spread resize costs across operations (2018).
On Christmas Day 2016, a commit changed the spinlock from memory_order_acquire to memory_order_acq_rel with the rationale: "since test-and-set is both a read and a write operation, it should [use acq_rel]." This reasoning is incorrect — the standard spinlock pattern is acquire on lock, release on unlock. The "write" in test-and-set is the lock flag itself, which doesn't need release semantics during acquisition. On x86, it compiles to the same xchg instruction either way, so it was a no-op for Intel hardware. But on ARM or POWER, it would generate an extra barrier.
Nobody noticed because nobody was running libcuckoo on ARM in 2016. But it's the kind of quiet degradation that accumulates when a codebase has no strong review process.
The Security Kill: 2018-2021
The real blow came in three waves.
October 2018: Intel disclosed a TSX memory ordering issue in Skylake processors. HLE (Hardware Lock Elision, the simpler half of TSX) was disabled entirely. RTM (Restricted Transactional Memory, the explicit transaction half) was hobbled — it lost a performance counter when used outside SGX mode. Libcuckoo never used TSX, so this didn't matter directly. But it signaled that TSX was becoming a liability.
November 2019: Researchers disclosed TAA — TSX Asynchronous Abort (CVE-2019-11135). TSX transactions that aborted could leak data from CPU-internal buffers, similar to the MDS/Zombieload family of speculative execution attacks. This was a side-channel vulnerability baked into the fundamental mechanism TSX used to track speculative reads and writes.
June 2021: Intel shipped the killing blow. A microcode update disabled TSX on all processors from Skylake through Coffee Lake and Whiskey Lake. The update made RTM technically present in CPUID but forced every transaction to abort immediately. HLE was already dead. An "Unsupported Software Development Mode" existed to re-enable RTM, with Intel's explicit warning that "this mode should not be enabled on production systems."
For good measure, Intel had already removed TSX from consumer processors starting with 10th-gen Comet Lake and Ice Lake (2020). TSX survived only on some Xeon server SKUs — Sapphire Rapids (2023) still lists it, though with the TSXLDTRK extension for suspend/resume of load tracking.
The hardware feature that the EuroSys 2014 paper was optimized around no longer exists on any consumer processor, and is discouraged on servers.
What's Left: 2024
By the time I cloned libcuckoo in April 2026, the situation was this:
The library had 402 commits, the most recent substantive changes from 2022-2024 being bug fixes and CMake compatibility updates. The README still linked to the NSDI 2013 and EuroSys 2014 papers. The code still used the same striped spinlock architecture from 2014, with the slightly-wrong memory_order_acq_rel from the 2016 Christmas commit. No TSX, no lock-free reads, no SIMD-accelerated probing.
I benchmarked it on an AMD Ryzen 9 3900 with 3 isolated CPUs, each thread pinned to its own dedicated core. The results were not kind.
Single-threaded, libcuckoo was slower than std::unordered_map — 10.77 vs 13.32 Mop/s on lookups, roughly 0.81x. Every operation pays the spinlock tax even with zero contention. An uncontended test_and_set plus clear costs 15-25 ns of pipeline disruption. Not catastrophic, but measurable.
The latency story is more interesting. Libcuckoo's P50 lookup latency is 150 ns vs unordered_map's 210 ns — 29% better. P99 is 441 ns vs 671 ns — 34% better. The bounded two-bucket probing gives cuckoo hashing a tighter distribution than chained hashing, where a bad collision creates an unbounded linked-list traversal. For latency-sensitive code, that P99 gap matters.
Multi-threaded, the library does what it claims. With proper CPU pinning on isolated cores (80% read, 20% write workload):
| Container | 1T (Mop/s) | 2T | 3T | 3T Scaling |
|---|---|---|---|---|
| libcuckoo | 5.29 | 10.26 | 14.15 | 2.55x |
unordered_map+rwlock |
5.70 | 1.43 | 1.40 | 0.25x |
Libcuckoo scales to 2.55x at 3 threads while unordered_map behind a shared_mutex collapses to 0.25x under write contention. The striped spinlocks work — with 65,536 lock stripes, two threads with random keys almost never hit the same lock. perf stat confirmed identical IPC and cache-miss rates between 1T and 3T runs, with near-perfect linear scaling on 100% read workloads (41.8 Mop/s at 3T vs 14.0 Mop/s at 1T).
But 14 Mop/s per core is a far cry from the paper's 70+ Mop/s reads. Part of that is the different hardware (Zen 2 vs Haswell). Part of it is the missing TSX fast path that the paper's numbers depended on. The spinlock fallback works correctly, but it's paying an atomic round-trip on every operation that TSX would have elided.
The Lesson
There are two lessons here, and the obvious one is the less important.
The obvious lesson is that hardware assumptions rot. TSX was a reasonable bet in 2014. Intel was pushing it as the future of concurrent data structures. Smart people at CMU and Intel Labs built excellent software around it. Then security researchers found that TSX's speculative execution model leaked data through side channels — the same class of vulnerability that killed Spectre and Meltdown mitigations. Intel killed TSX, and everything built around it lost its fast path.
The library's spinlock fallback works. It scales. On our benchmarks it hit 2.55x at 3 threads, and perf stat shows no pathological cache-line bouncing. But 14 Mop/s per core on reads is not 70 Mop/s. The gap is partly hardware generational, partly the cost of atomic operations that TSX would have hidden. A test_and_set + clear round-trip on every read — even uncontended — costs 15-25 ns that a successful TSX transaction would skip entirely.
The less obvious lesson is about the gap between papers and libraries. The EuroSys 2014 paper was honest. It showed both TSX and non-TSX numbers. It acknowledged the spinlock path was slower. But the open-source library only ever shipped the spinlock path, while linking to a paper whose headline numbers required TSX. A decade later, someone cloning the repo and reading the paper would reasonably expect performance that the library has never delivered.
This isn't a criticism of the authors. They made the right call in 2014. TSX wasn't universally available, the spinlock path was a good fallback, and the library was genuinely useful for concurrent workloads. But twelve years passed, the hardware changed, and the library's performance story didn't get updated. Nobody added a note saying "the numbers in the papers require TSX, which Intel has since disabled." Nobody updated the lock implementation for the post-TSX world.
The code didn't get worse. The world got different.
What Would Fix This
The library works. It scales. But closing the gap to the paper's TSX-era numbers would require rethinking the per-operation locking overhead. Some options:
Lock-free reads: The current design locks on every read. A read-optimized version could use sequence counters (seqlock) for the read path — read the sequence number, read the data, re-read the sequence number, retry if it changed. No atomics on the read side in the common case. This is what the Linux kernel's RCU and seqlock mechanisms do. The 15-25 ns per-read spinlock tax would vanish.
SIMD-accelerated probing: absl::flat_hash_map uses SSE2 to compare 16 control bytes simultaneously. Libcuckoo uses sequential partial-hash comparison across 4 slots. Adding SIMD probing to the cuckoo table's two-bucket structure would cut the per-operation comparison work roughly in half.
Sharded design: Instead of fine-grained locking across one big table, use N independent hash tables with no shared state. Each thread owns a shard. Cross-shard lookups go through a wait-free protocol. This eliminates lock traffic entirely for same-shard operations.
For anyone choosing a concurrent hash table today: libcuckoo delivers real concurrent scaling with low tail latency. But its single-threaded performance lags std::unordered_map by ~20% due to the per-operation spinlock cost. Whether that tradeoff works depends on your read/write ratio and thread count. For read-dominated workloads where shared_mutex can let readers run in parallel, a simpler rwlock around a fast single-threaded table may be competitive.
Timeline Summary
| Date | Event |
|---|---|
| Feb 2012 | Intel documents TSX |
| Jun 2013 | TSX ships in Haswell processors |
| Jan 2014 | libcuckoo initial commit (spinlocks only, no TSX) |
| Apr 2014 | EuroSys paper published (benchmarks with TSX) |
| Aug 2014 | Intel disables TSX on Haswell due to correctness bug |
| Nov 2014 | TSX fixed in Broadwell F-0 stepping |
| 2015 | TSX available on Skylake |
| Dec 2016 | libcuckoo spinlock changed from acquire to acq_rel |
| Dec 2018 | libcuckoo adds lazy rehashing (last major feature) |
| Oct 2018 | Intel disables HLE on Skylake, hobbles RTM |
| Nov 2019 | TAA vulnerability disclosed (CVE-2019-11135) |
| 2020 | Intel removes TSX from Comet Lake / Ice Lake (consumer) |
| Jun 2021 | Intel microcode disables TSX on Skylake through Whiskey Lake |
| 2023 | Some Xeon Sapphire Rapids still have TSX (server only) |
| 2025 | libcuckoo's latest commit: CMake 4 compatibility fix |
Review quiz
Five questions about this article. Get four right and it counts as read. Review quizzes come with a membership.
Log in See membership
Comments
No comments yet. Be the first to share your thoughts.