Mastering Performant Code, Volume 2: Concurrency, Memory and the Algorithms behind Fast python
Format:
Paperback
En stock
0.45 kg
Sí
Nuevo
Amazon
USA
- Agents write your code. This book teaches you why it's slow.Your AI copilot can scaffold a service in minutes, but it can't tell you why latency spikes at 800,000 agents, why memory usage is 9x what sys.getsizeof() reports, or why adding async made things worse. That gap between "it works" and "it works under load" is what this book covers.Mastering Performant Code in Python, Volume 2 is a project-driven deep dive into Python performance for developers who ship code in production and need to understand what's happening below the API surface. You will build one complete system across 10 chapters: ChronoGuard Lite, a pure-Python agent compliance monitor. No Docker, no Redis, no infrastructure to wrangle. Every external service is replaced with a hand-built Python equivalent, so you learn the algorithms behind the tools, not the tools themselves. Each chapter adds a working module, benchmarks it against its naive predecessor, and shows you exactly where the time and memory go. What you'll learn:How CPython lays out objects in memory, and why a 48-byte object actually costs 423 bytes per instanceCache-aware data layout: columnar stores, struct-of-arrays, and why pointer chasing kills your throughputWhat the GIL actually serializes (and what it doesn't), and when threads help vs. when they hurtThread-safe data structures from scratch: locks, stripes, read-write locks, and the cost of sharingAsync I/O done right: event loops, backpressure, and the one blocking call that freezes everythingCryptographic audit chains with HMAC verification and checkpoint strategies that avoid quadratic costProbabilistic data structures (HyperLogLog, Count-Min Sketch, Bloom filters) for real-time analyticsHigh-performance string matching: tries, Aho-Corasick automata, and inverted index searchGraph algorithms for policy dependency resolution with topological evaluationEnd-to-end profiling: cProfile, py-spy, tracemalloc, and the discipline of measuring before you cutEvery benchmark number came from running the code. No fabricated data, no textbook estimates. You clone the repo, run the tests, and see the numbers on your own hardware. Who this book is for:You write Python professionally and you've hit a performance wall. Maybe your service is too slow under load. Maybe your memory usage is inexplicable. You know how to use the standard library, but you don't know what the standard library does. If you've been shipping Python in production for a year or more and want to understand the performance layer, this book is for you. What's included:10 chapters building a complete, working system from scratchA branch-per-chapter Git repository (github.com/j-raghavan/chronoguard-lite) so you can code along or use as referenceAn appendix with profiling tool selection guide, benchmark reference tables, gotchas index, and CPython version compatibility matrixWorks with Python 3.10 through 3.13 (including notes on the experimental free-threaded build)Volume 1 covered data structures from scratch. Volume 2 goes deeper: memory layout, concurrency, algorithms, and the measurement discipline that separates guessing from engineering.
IMPORT EASILY
By purchasing this product you can deduct VAT with your RUT number