Tricks to Optimise Numerical Code
Kousik Krishnan (~kousik) |
Data is the new oil. With data proliferating from all sides, processing them becomes computationally intensive. Python being the preferred language for easy prototyping , provides a powerful tool to handle these intensive tasks. But most often, the simplest analysis turn out to be painstakingly slow. This is because of the innate behavior of the language and bad coding practices by developers. When used effectively though, Python can be as fast as other languages like C.
By analyzing different scenarios during which python under performs, a formal rule driven approach has been developed which can serve as golden principles for optimizing compute intensive codes. In this talk, we will illustrate this approach using a simple algorithm and quantitatively measure its success using the total execution time as the performance metric.
Basic Outline of the talk
- Python and its performance issues [3-5 minutes]
- Strategies for effective coding [15-20 minutes]
- What/When to optimize?
- Identifying appropriate data structure
- Vectorisation using numpy - Best practices
- Static typing in python
- Data Parallelism and Python
- Overall framework presentation [2-3 minutes]
- Q/A [2 minutes]
Who is this talk for?
Pythonistas who frequently hunt for performance optimization tricks.
Developers looking to switch to Python for handling computationally intensive tasks
- Experience in handling computationally intensive codes.
- Basics of data-structures (tree, heaps, hashmap, etc.)
- Experience with vectorisation using numpy
- Basic understanding of static vs dynamic typing
Beginners who do not have the recommended pre-requisites will be able to comprehend but not fully appreciate the content.
The presentation which is currently in development can be viewed here.
A short video pitch of the talk is available here.
All the codes will be made available by the latest.
Kousik is a Quant Analyst working in the financial services industry where he is responsible for developing quantitative models for financial prediction and risk management. He primarily uses Python and C++ for dealing with number crunching tasks and is constantly in lookout for cool tricks to optimize code. In his college days, he successfully helped develop a high performance risk management framework for an alternate investment fund which was validated and approved by SEBI. He was also involved in different technical talks at IIT-M, conferences like PySangamam and is a member of the Chennai Python Meetup group. His love for python started 5 years ago, with a multitude of quant finance and machine learning projects.