Writing High Performance Python Code
© Elephant Scale October 21, 2020
Overview
Python is a very popular, easy-to-use language that is widely adopted by developers, admins and data scientists. However, here be dragons! Many people who pick up Python lack proper coding discipline, which results in code that is hard to maintain and that runs painfully slow.
This course teaches good Python coding discipline, how to avoid bottlenecks and to write high performance code in Python
What you will learn:
- Well-architected Python project
- Understand python execution architecture
- Learn to use profilers to spot bottlenecks
- Efficient search and retrieval on Collections
- Using numpy for fast numeric operations
- Compiling to native code
Duration:
Half day to a day
Audience:
Developers, data analysts, data scientists
Skill level
Intermediate
Prerequisites
- Basic knowledge of Python language is recommended
Lab environment
- Students will need to have a Python development environment like Anaconda
- Instructions will be provided on how to set this up
Students will need the following
- A reasonably modern laptop
- Chrome browser
Detailed Course Outline
Well-structured project
- Modeling
- Running
- Testing
Profiling and optimization
- Timing
- Profiling with CProfiler
- Optimization
Understand Execution Architecture
- Python’s virtual machine
- Understand CPU/Memory/Cache/Disk
Efficient search and retrieval on collections
- Computational complexity
- Working with Lists and Deques
- Lists vs Arrays
- Using Dictionaries
- Sets
- Heaps and priority queues
- Use caching
- Memory optimization
Using numpy for fast numeric operations
- Introduction to Numpy library
- Converting numeric code to Numpy
Compiling to native code
- Introduction to python compilers
- Using Cython