Jump to ratings and reviews
Rate this book

High Performance Python: Practical Performant Programming for Humans

Rate this book
Your Python code may run correctly, but you need it to run faster. By exploring the fundamental theory behind design choices, this practical guide helps you gain a deeper understanding of Python’s implementation. You’ll learn how to locate performance bottlenecks and significantly speed up your code in high-data-volume programs. How can you take advantage of multi-core architectures or clusters? Or build a system that can scale up and down without losing reliability? Experienced Python programmers will learn concrete solutions to these and other issues, along with war stories from companies that use high performance Python for social media analytics, productionized machine learning, and other situations.

370 pages, Paperback

First published October 22, 2013

154 people are currently reading
710 people want to read

About the author

Micha Gorelick

3 books6 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
95 (39%)
4 stars
97 (40%)
3 stars
39 (16%)
2 stars
6 (2%)
1 star
1 (<1%)
Displaying 1 - 22 of 22 reviews
Profile Image for Rustam Aliyev.
96 reviews1 follower
February 9, 2018
Good: As book states, it is meant to be read by intermediate-advanced Python developers. It mainly adds color to the notions one already used while developing software and well explains the reasons behind each operation. Profiling chapter was very informative as well as parallel and concurrent programming related ones. In addition, many external libraries and frameworks get introduced which can significantly simplify and enhance the developed application.

Bad: This book will not teach you how to implement a particular technique, reader is expected to dig to the internet / docs to understand the concepts thoroughly. Code examples are not easy to follow. "Lessons from the field" chapter looked more like startup promotion rather than explaining the tech stack, it is hard to understand the userbase, etc.
Profile Image for Vlad Ardelean.
157 reviews34 followers
January 27, 2019
Very informative book, even though it's mostly talking about python 2.7 (the current stable version is 3.7).

What I found most useful were:
1. Talks about various tools/interpreters/compilers to help speed up python computations. Notable mentions: PyPy, Cython, numpy, numba, numexpr

2. Various profilers: line_profiler (for time), memory_profiler (for memory...), pympler (again, for memory). Heapy.guppy would have been awesome, but it's py 2.7 only (for memory profiling...for now?)

3. The ubiquitous dict - its workings were explained in great details. Too bad however that in a recent python version, the dict was greatly refactored - now it retains insertion order, and takes up less space.

4. The discussion about how how the processor caches work, and how python lists are not optimized to take advantage of them was really cool. We have array.array, numpy and numexpr to the rescue here

5. Using less RAM - that chapter was nice because in addition to finding out (in the previous chapters) how contiguous arrays are better than lists of pointers, here the author presents some data structures and algorithms for storing/searching through strings a lot faster. These were pretty new to me: tries and DAWGs ftw! Also some lossy data structures are presented: The *LogLog* family, the Morris counter, the K-Minimum Values, and the bloom filter.

The final chapter then showcases the technology stack of a few companies. It's always interesting to hear what other people are doing.

Even if slightly dated, this is an awesome book! I'd recommend it to anyone who spent at least one year programming Python.
Profile Image for Ethan Swan.
65 reviews
June 22, 2021
3 stars is about as low as a full-length O’Reilly book can earn. There’s no doubt the authors knew their stuff, but the book is extremely dense. It was also hard to figure out what field the authors had in mind – certain sections focus on data science, but in my experience it’s very rare to be extremely performance-sensitive while also working with a volume of data small enough to be handled in pure Python (as opposed to distributed across a cluster solution, like Spark or a relational database). This book really only spent time on pure Python solutions.

I don’t think I got much of anything out of this book except a) a strong inclination to avoid tinkering with Cython and C extensions and b) an appreciation of how much optimization is already handled for users of Pandas and Numpy. However, I can see how I may just not be the ideal audience for what’s discussed, and someone who really needed to learn about C extensions or threading would probably find this book a good way to become familiar.
58 reviews2 followers
May 17, 2016
This is a must-read for anyone building larger or more demanding software using Python. It gives an overview of ways that you can use to make your code fly. It's just deep enough to get you going in some direction, but it's short and to the point so that you can finish it in a few days and come away with your head full of new ideas.

The authors do a great job of sequentially building up a pool of knowledge, going from "easy to implement" changes to "let's roll out the big guns" solutions and so cover an extremely wide range of scenarios that a Python developer will be faced with.

The writing itself is clear and the book is full of great code examples to give the reader some hands-on ways to put this knowledge to use right away.
4 reviews
June 22, 2021
As someone who mainly sees Python from an analysis or modeling perspective I appreciated the variety of performance engineering tools covered in this book, some of which I had heard of and many that were completely new. While I did not find every chapter immediately relevant, I was typically engaged by the authors' examples (including code repository).

I really enjoyed how the authors' would start with toy problem and walk through the process of profiling & improving performance to move from "this code solves it" to "this code efficiently solves this". The pi estimation section to introduce & review multiprocessing was a great example of this build-up.

I found the ending of the book (a chapter on lessons from the field) to be a bit disappointing. This section was vague and only loosely connected to sections covered in the book. I appreciate the inclusion of real-world applications, but would have appreciated one or two deep-dive examples versus a smattering of examples.
86 reviews
May 13, 2016
There's a ton of useful ideas in this book, but very few of them are explained well. It should be viewed as a list of suggestions for Python documentation to go read.
Profile Image for Serhii Kushchenko.
109 reviews19 followers
August 10, 2023
This book can teach you interesting and helpful tricks that most Python programmers don't know about. These tricks can make your code run faster and use less computer memory. And the best part is, they're pretty easy to utilize. In most cases, you'll need to make only a few small changes to your existing code.

However, the book does come with some noticeable downsides. Its language can be needlessly confusing, making it tough to read. The issues it tackles are not commonly encountered in typical Python programming for businesses. Still, it could provide you with some talking points during job interviews.

A few of the discussed problems seem a bit contrived. Unless you're in academia, you probably won't need to handle things like liquid diffusion calculations. The readability of the Python code examples has room for improvement. It would be nice if the authors included type annotations in the book's next edition. They often use nonlocal variables. By using callable classes instead, the code becomes much easier to understand.

Chapters 6 and 7 delve into matrix operations and how to compile code for tackling demanding computational tasks. If you come across such challenges, you might find the need for extra references beyond this book. The chapters about code profiling, parallel programming, and reducing RAM usage are good. The chapter focusing on asynchronous code showcases some thought-provoking examples.

Though it has some flaws, I believe I've invested my time well by studying this book's content.
2 reviews
July 11, 2024
As the authors present up front, this book is primarily for scientific python programmers dealing with CPU bound problems. While I came at this book with a primary interest in data processing, the sections on what makes Python slow (and practically-fast) are universally applicable to anyone working with the language. The chapters on concurrency, multi-threading, and multiprocessing are likewise well-explained, and I also appreciated the introduction to performance profiling tools in Python.

Most data engineers won't have a use case to dip down into Cython, so if you're like me you can skim these parts. I was pleasantly surprised, though, at the options for optimizing Python code down at the C implementation level without ever needing to write a function in C yourself.

There's some gestures at exercises for you to explore on your own, but this book is mostly an introduction to tools and concepts.
Profile Image for Atanas Nikolov.
237 reviews15 followers
August 12, 2025
Some piece of the book are quite informative, especially if you haven't heard about the concepts. But many of the examples are mostly applicable to scenarios that I don't think matter in modern programming. Or maybe they matter specifically in data science, but then the book should have been something like "High Performance Python for Data Science". Seriously more than 2/3 of the book feel super data science specific, and the takeaways can hardly be applied to web development, data engineering, or even CLI tooling. Plus, the books spends quite a lot of time focusing on toy problems and explaining them, instead of giving you actual knowledge. Sure, you learn through examples, but in my experience with everything I study, toy problems are mostly never a good example.

There could've been so much good info on async programming, and even multiprocessing, but alas...
Profile Image for Nickolai.
891 reviews8 followers
May 29, 2024
Первая половина книги, может, и не плоха. Но затем авторы углубляются в слишком большие дебри. Советы, преподносимые ими, могут быть полезны очень узкому числу программистов, в основном тем, кто имеет дело со сложными математическими вычислениями. Примеры кода во многих случаях можно было упростить.
Profile Image for Vlad Bezden.
236 reviews14 followers
May 20, 2022
A very comprehensive book that covers the memory and performance of Python. Even though the book's title contains "performance," it also has a chapter on memory management. Book has excellent and up to the point examples.
93 reviews5 followers
October 27, 2017
虽然一开始只是想买来学习一下并行计算相关的内容,翻开后发现讲的远不止并行计算而已,很专业。
253 reviews3 followers
August 16, 2018
Some good insights into how to deal with performance issues with Python. Much of this is standard strategies for profiling.
Profile Image for drew.
17 reviews
August 17, 2025
how to make your python code faster:
1. Use more memory-efficient data structures
2. Utilise concurrency and parallelism
3. Use C instead
absolute cinema 5/5
Profile Image for Povilas Balciunas.
35 reviews1 follower
March 14, 2017
A good read about some of the python internals related to performance.
I learned about some new tools and practices.
Especially Cython and probabilistic data structures which will definitely be useful.
Profile Image for Jeremy.
48 reviews
February 5, 2017
Very practical book about performance optimization in Python. The reader is introduced to various tools and practices to help improve the performance of existing Python programs.

The approach is well described and very methodological. The book can (should?) be read from cover to cover, because the topics are introduced in the natural way of the optimization process. Isolate, profile and optimize the parts of a program (or system).

It's also quite funny to go in the details of multiprocessing, synchronization between processes and all the complex things around, to end up with the conclusion: "Do consider writing code that runs a bit slower but is more likely to be understood by your team". Writing concurrent code is indeed difficult and error prone, so it's for the best if we can avoid it.

The last chapter titled "Using less RAM" is really enjoyable. Instead of just executing parts of a program with another language or use specific tools to reach better performance, one can make tremendous improvements by using the right approach. It is nice to see that data structures and algorithms that can be considered as advanced and complicated can become very useful and have practical applications.

A second edition would be very welcomed with all the new additions from the past 3 years: asyncio with async / await, focus on Python 3 instead of legacy Python, and all the other good stuff.
20 reviews1 follower
March 27, 2016
I am half way through and cannot believe how good this book is. It matches just right with my general programming experience and newbie Python experience providing good overview of Python profiling and optimization techniques and tools. The authors seem to know what are they taking about and the text strikes just the right balance with details (at least to my level). Even things I already knew explained well enough to serve as a good refresher. I will add more details once I am done but I know I will be recommending this book to developers who want to do serious things in Python.

PS: The second author is shown incorrectly in Goodreads for some reason. It should be Ian Ozsvald.
Profile Image for Franck Chauvel.
119 reviews5 followers
May 21, 2016
High Performance Python helps you speed up your python programs, especially numerical/scientific applications. It covers many practices ranging from profiling CPU and memory to AOT and JIT compilation using Cython, parallelism and distribution, and many other Python tools.

Having read it from cover to cover, I feel overwhelmed by the many tips and tricks (library, compilers, interpreters, etc.). Yet, I feel there is some wisdom on how one systematically approaches performance optimization, but it is spread all around. The text would benefit from stepping back for a minute from the Python ecosystem to highlight the methodology. Still this was definitely a very instructive reading.
Profile Image for Serdar.
Author 13 books33 followers
June 22, 2017
Really good soup to nuts overview of getting the most out of Python. The section on Cython is a little short for my taste, hence the docking of one star, but there's also a great standalone book on that very framework, so I can't complain too much. Great for most every class of user, from those doing scientific computing to those developing generically in Python and who just want to know how to eke out that much more oomph.
Displaying 1 - 22 of 22 reviews

Can't find what you're looking for?

Get help and learn more about the design.