4. Profiling and Optimization
June 26, 2014 ยท View on GitHub
Full list of references in Chapter 4 of the IPython Cookbook, the definitive guide to high-performance scientific computing and data science in Python, by Dr. Cyrille Rossant, Packt Publishing, 400 pages, 2014.
Profiling
- Program optimization on Wikipedia.
- Python's
timeitmodule. - Python's
profilemodule. easy_profilerthat simplifies the use of Python profiling tools.line_profiler, a line-by-line profiler, for Python 2 only.- How to deal with
@profilein profiled code. - RunSnakeRun, a viewer for profiling results.
Memory profiling
memory_profilerpackage.psutilpackage, required bymemory_profiler.- Guppy-PE, a memory profiling package.
- PySizer, a memory profiler for Python.
- Pympler, another memory profiler.
Code tracing
- Python's
tracemodule. - Online Python Tutor, a great educational interactive tool to visualize the step-by-step execution of Python code.
- Some Python profiling tools.
NumPy code optimization
- Broadcasting rules and examples.
- Array interface in NumPy.
- Locality of reference.
- Internals of NumPy in the SciPy lectures notes.
- The complete list of NumPy routines is available on the NumPy Reference Guide.
- List of indexing routines.
- NumPy Performance Tricks.
- 100 NumPy exercices.
Memory mapping
Sparse matrices
HDF5
- PyTables
- h5py
- Partial list of HDF5 users
- HDF5 chunking.
- PyTables optimization guide, a must-read for PyTables users.
- In-kernel queries in PyTables.
- An alternative to PyTables and HDF5 might come from the Blaze project, still in early development at the time of writing.
- Difference between PyTables and h5py, from the perspective of h5py.
- Difference between PyTables and h5py, from the perspective of PyTables.