Book description
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.
- 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
- Use tools to compile Python down to machine code
- Manage multiple I/O and computational operations concurrently
- Convert multiprocessing code to run on a local or remote cluster
- Solve large problems while using less RAM
Table of contents
- Preface
- 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
- Using runsnakerun to Visualize cProfile Output
- Using line_profiler for Line-by-Line Measurements
- Using memory_profiler to Diagnose Memory Usage
- Inspecting Objects on the Heap with heapy
- Using dowser for Live Graphing of Instantiated Variables
- Using the dis Module to Examine CPython Bytecode
- 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. Matrix and Vector Computation
- 7. Compiling to C
- 8. Concurrency
- 9. The multiprocessing Module
- 10. Clusters and Job Queues
- 11. Using Less RAM
- 12. Lessons from the Field
- Index
- Colophon
- Copyright
Product information
- Title: High Performance Python
- Author(s):
- Release date: September 2014
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781449361594
You might also like
book
Effective Python: 90 Specific Ways to Write Better Python, 2nd Edition
Updated and Expanded for Python 3 It’s easy to start developing programs with Python, which is …
book
Python for Finance, 2nd Edition
The financial industry has recently adopted Python at a tremendous rate, with some of the largest …
book
Python for Programmers, First Edition
The professional programmer's Deitel® guide to Python® with introductory artificial intelligence case studies Written for programmers …
book
Python Crash Course, 2nd Edition
This is the second edition of the best selling Python book in the world. Python Crash …