It's the memory latency, stupid(pivotlake.io)
261 points by ntur1337 1 day ago | 97 comments
tl;dr: When a CPU appears 100% utilized, it's often stalled waiting on DRAM (50-100ns latency vs ~1ns for L1 cache). The author demonstrates this with a GROUP BY query where perf shows 50% of CPU slots stalled on memory, then applies radix partitioning to split the hash table into 4096 smaller tables that fit in cache—cutting DRAM reads from 4.5GB to 1.5GB and runtime from 3.6s to 2.7s. Their Pivot engine, with further optimizations, hits 1.8s single-core and 171ms across 16 cores.
HN Discussion:
  • ↑Shares personal experience confirming memory access patterns matter more than raw CPU usage
  • ↑Laments how modern software abstractions ignore memory efficiency despite huge caches
  • ↑Argues cache-aware code should be prioritized from the start over clean code aesthetics
  • ↓Dismisses the technique as just known radix-partitioned aggregation with nothing novel
  • ~Views the proposed solution as a modest clustered hashmap improvement, not groundbreaking