Book description
Your Python code may run correctly, but you need it to run faster. Updated for Python 3, this expanded edition shows you how to locate performance bottlenecks and significantly speed up your code in high-data-volume programs. By exploring the fundamental theory behind design choices, High Performance Python helps you 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? Experienced Python programmers will learn concrete solutions to many issues, along with 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
- 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
- Foreword
- 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
- Visualizing cProfile Output with SnakeViz
- Using line_profiler for Line-by-Line Measurements
- Using memory_profiler to Diagnose Memory Usage
- Introspecting an Existing Process with PySpy
- 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. Matrix and Vector Computation
-
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
- Graphics Processing Units (GPUs)
- Foreign Function Interfaces
- Wrap-Up
- 8. Asynchronous I/O
- 9. The multiprocessing Module
- 10. Clusters and Job Queues
-
11. Using Less RAM
- Objects for Primitives Are Expensive
- Understanding the RAM Used in a Collection
- Bytes Versus Unicode
- Efficiently Storing Lots of Text in RAM
- Modeling More Text with Scikit-Learn’s FeatureHasher
- Introducing DictVectorizer and FeatureHasher
- SciPy’s Sparse Matrices
- Tips for Using Less RAM
- Probabilistic Data Structures
-
12. Lessons from the Field
-
Streamlining Feature Engineering Pipelines with
Feature-engine
- Feature Engineering for Machine Learning
- The Hard Task of Deploying Feature Engineering Pipelines
- Leveraging the Power of Open Source Python Libraries
- Feature-engine Smooths Building and Deployment of Feature Engineering Pipelines
- Helping with the Adoption of a New Open Source Package
- Developing, Maintaining, and Encouraging Contribution to Open Source Libraries
- Highly Performant Data Science Teams
- Numba
- Optimizing Versus Thinking
- Adaptive Lab’s Social Media Analytics (2014)
- Making Deep Learning Fly with RadimRehurek.com (2014)
- Large-Scale Productionized Machine Learning at Lyst.com (2014)
- Large-Scale Social Media Analysis at Smesh (2014)
- PyPy for Successful Web and Data Processing Systems (2014)
- Task Queues at Lanyrd.com (2014)
-
Streamlining Feature Engineering Pipelines with
Feature-engine
- Index
- About the Authors
Product information
- Title: High Performance Python, 2nd Edition
- Author(s):
- Release date: April 2020
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781492055020
You might also like
book
Introducing Python, 2nd Edition
Easy to understand and fun to read, this updated edition of Introducing Python is ideal for …
book
Python Cookbook, 3rd Edition
If you need help writing programs in Python 3, or want to update older Python 2 …
book
Head First Python, 2nd Edition
Want to learn the Python language without slogging your way through how-to manuals? With Head First …
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 …