Book description
Your Python code may run correctly, but what if you need it to run faster? This practical book shows you how to locate performance bottlenecks and significantly speed up your code in high-data-volume programs. By explaining the fundamental theory behind design choices, this expanded edition of High Performance Python helps experienced Python programmers gain a deeper understanding of Python's implementation.
How do you take advantage of multicore architectures or clusters? Or build a system that scales up and down without losing reliability? Authors Micha Gorelick and Ian Ozsvald reveal concrete solutions to many issues and include war stories from companies that use high-performance Python for social media analytics, productionized machine learning, and more.
- Get a better grasp of NumPy, Cython, and profilers
- Learn how Python abstracts the underlying computer architecture
- Use profiling to find bottlenecks in CPU time and memory usage
- Write efficient programs by choosing appropriate data structures
- Speed up matrix and vector computations
- Process DataFrames quickly with pandas, Dask, and Polars
- Speed up your neural networks and GPU computations
- Use tools to compile Python down to machine code
- Manage multiple I/O and computational operations concurrently
- Convert multiprocessing code to run on local or remote clusters
- Deploy code faster using tools like Docker
Publisher resources
Table of contents
- Brief Table of Contents (Not Yet Final)
- 1. Understanding Performant Python
-
2. Profiling to Find Bottlenecks
- Profiling Efficiently
- Introducing the Julia Set
- Calculating the Full Julia Set
- Simple Approaches to Timing—print and a Decorator
- Simple Timing Using the Unix time Command
- Using the cProfile Module
- Visualizing cProfile Output with SnakeViz
- Using line_profiler for Line-by-Line Measurements
- Using memory_profiler to Diagnose Memory Usage
- Combining CPU and Memory Profiling with Scalene
- Introspecting an Existing Process with PySpy
- VizTracer for an interactive time-based call stack
- Bytecode: Under the Hood
- Unit Testing During Optimization to Maintain Correctness
- Strategies to Profile Your Code Successfully
- Wrap-Up
- 3. Lists and Tuples
- 4. Dictionaries and Sets
- 5. Iterators and Generators
- 6. Pandas, Dask and Polars
-
7. Compiling to C
- What Sort of Speed Gains Are Possible?
- JIT Versus AOT Compilers
- Why Does Type Information Help the Code Run Faster?
- Using a C Compiler
- Reviewing the Julia Set Example
- Cython
- pyximport
- Cython and numpy
- Numba
- PyPy
- A Summary of Speed Improvements
- When to Use Each Technology
- Foreign Function Interfaces
- Wrap-Up
- 8. Asynchronous I/O
- 9. The multiprocessing Module
- 10. Clusters and Job Queues
- About the Authors
Product information
- Title: High Performance Python, 3rd Edition
- Author(s):
- Release date: May 2025
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098165963
You might also like
book
High Performance Python, 2nd Edition
Your Python code may run correctly, but you need it to run faster. Updated for Python …
book
Think Python, 3rd Edition
Python is an excellent way to get started in programming, and this clear, concise guide walks …
book
Fluent Python, 2nd Edition
Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets …
book
Introducing Python, 2nd Edition
Easy to understand and fun to read, this updated edition of Introducing Python is ideal for …