更新时间:2021-07-02 13:07:53
coverpage
Title Page
Copyright
Advanced Python Programming
About Packt
Why Subscribe?
Packt.com
Contributors
About the Authors
Packt Is Searching for Authors Like You
Preface
Who This Book Is For
What This Book Covers
To Get the Most out of This Book
Download the Example Code Files
Conventions Used
Get in Touch
Reviews
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
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
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
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
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