Customer Feedback Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions Benchmarking and Profiling Designing your application Writing tests and benchmarks Timing your benchmark Better tests and benchmarks with pytest-benchmark Finding bottlenecks with cProfile Profile line by line with line_profiler Optimizing our code The dis module Profiling memory usage with memory_profiler Summary Pure Python Optimizations Useful algorithms and data structures Lists and deques Dictionaries Building an in-memory search index using a hash map Sets Heaps Tries Caching and memoization Joblib Comprehensions and generators Summary Fast Array Operations with NumPy and Pandas Getting started with NumPy Creating arrays Accessing arrays Broadcasting Mathematical operations Calculating the norm Rewriting the particle simulator in NumPy Reaching optimal performance with numexpr Pandas Pandas fundamentals Indexing Series and DataFrame objects Database-style operations with Pandas Mapping Grouping, aggregations, and transforms Joining Summary C Performance with Cython Compiling Cython extensions Adding static types Variables Functions Classes Sharing declarations Working with arrays C arrays and pointers NumPy arrays Typed memoryviews Particle simulator in Cython Profiling Cython Using Cython with Jupyter Summary Exploring Compilers Numba First steps with Numba Type specializations Object mode versus native mode Numba and NumPy Universal functions with Numba Generalized universal functions JIT classes Limitations in Numba The PyPy project Setting up PyPy Running a particle simulator in PyPy Other interesting projects Summary Implementing Concurrency Asynchronous programming Waiting for I/O Concurrency Callbacks Futures Event loops The asyncio framework Coroutines Converting blocking code into non-blocking code Reactive programming Observables Useful operators Hot and cold observables Building a CPU monitor Summary Parallel Processing Introduction to parallel programming Graphic processing units Using multiple processes The Process and Pool classes The Executor interface Monte Carlo approximation of pi Synchronization and locks Parallel Cython with OpenMP Automatic parallelism Getting started with Theano Profiling Theano Tensorflow Running code on a GPU Summary Distributed Processing Introduction to distributed computing An introduction to MapReduce Dask Directed Acyclic Graphs Dask arrays Dask Bag and DataFrame Dask distributed Manual cluster setup Using PySpark Setting up Spark and PySpark Spark architecture Resilient Distributed Datasets Spark DataFrame Scientific computing with mpi4py Summary Designing for High Performance Choosing a suitable strategy Generic applications Numerical code Big data Organizing your source code Isolation, virtual environments, and containers Using conda environments Virtualization and Containers Creating docker images Continuous integration Summary