The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Cache-Line Mechanics, SoA Layouts, SIMD Vectorization, and Memory Access Optimization for High-Performance Systems
Your CPU is not slow. Your data is in the wrong place. Every cache miss your hot loop pays is not a hardware limitation, it is a layout decision that was never made consciously. The pointer your code chases, the struct field your loop skips over, the heap allocation that landed three megabytes from the last one: these are the real performance bottlenecks in CPU-bound systems, and none of them show up in a complexity analysis. This book teaches you to see your data the way the hardware sees it, measure what it costs, and redesign it so the memory system works with your code instead of against it.
Minimum price
$29.00
$49.00
About the Book
Learn to eliminate cache miss bottlenecks and memory stall penalties with confidence using measured, verified data layout engineering, guided by a systems programmer’s playbook for struct design, access pattern optimization, and concurrent data structure architecture across CPU-bound production systems.
Key Features
Book Description
Most engineers reach for algorithmic optimizations when their code is slow, unaware that the same pointer-connected heap layout or the same AoS struct that looked fine in testing will stall the CPU on memory the day the working set actually grows. This book closes that gap, providing the practical knowledge of cache line mechanics, data layout transformation, and concurrent system design needed to build software with measured throughput guarantees, not assumed ones.
You will begin at the silicon level, understanding what cache lines physically are, how the memory hierarchy imposes latency on every access that misses it, and why the pointer-connected layouts that object-oriented design naturally produces are structurally hostile to the hardware. You will measure the problem before touching a single struct, using hardware performance counters to quantify cache miss rates, memory stall fractions, and instructions per cycle across your real hot paths.
The book walks through the full arc of production data-oriented engineering: struct field ordering and padding elimination, hot and cold data separation, Array of Structures to Structure of Arrays conversion that unlocks compiler auto-vectorization, AoSoA hybrid layouts, Entity Component Systems with dense archetypal storage and generational handles, flat array replacements for pointer-based trees and lists, slot maps that provide O(1) stable-handle lookup without pointer indirection, software prefetching, cache tiling, false sharing elimination, per-thread work partitioning, and lock-free ring buffer design where memory layout determines coherence traffic as much as the algorithm does. Three applied chapters walk a scene graph, a high-frequency trading order book, and a particle system through complete transformations with hardware counter measurements at every step.
Whether you are optimizing your first cache-bound simulation loop or hardening a production system that must sustain low latency under real concurrent load, this book provides actionable layout techniques and measurement discipline for performance that holds under live workloads.
What You Will Learn
Who This Book Is For
This book is for C++ systems engineers, performance engineers, and senior developers building or optimizing throughput-critical software across game engines, simulation systems, financial infrastructure, and any domain where the gap between theoretical hardware throughput and measured application performance demands a hardware-level explanation. No prior knowledge of data-oriented design or CPU microarchitecture is assumed.
Table of Contents
About the Author
Weston Ashgrove is a C++ quant trading developer who builds the parts of a trading system that cannot be allowed to be wrong: order books, matching logic, and the concurrency and memory-layout work underneath them. He has a simple rule for latency-critical code: nothing is true until it has been profiled, fuzzed, and replayed. That rule runs through this book, from the first order book benchmark to byte-identical crash recovery. He writes for engineers who ship and debug these systems, and he skips the theory that never survives contact with real order flow.https://x.com/dxled_dc
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.