Python Optimization Basics
A first principle approach to optimizing your code
This is a series of articles based on my experience optimizing python programs. The goal of this is to build an effective base and understanding of optimization and how you should approach it.
Optimization is generally not something I consider as an event, which is something I do when something becomes catastrophically slow. It is a repetitive process and one that occurs as you work on a branch of code, then as your coworkers work on your branch and you on a branch that someone else has worked on. In a healthy codebase it happens continuously.
The general misconception is that you need to do it rarely , and the lazy approach is that you throw in a threading or multiprocessing structure, or worse some complicated architectural rework when you don’t need to. I am not saying you never need to do that, but that often people overlook these fundamental concepts and jump directly to these complicated solutions. If you have an effective base, you won’t be hindered from adopting these solutions, in fact you will benefit alot more since you have greater room for improvement.
In this series of articles, I will try my best to walk you through how I learnt to optimize effectively as well as the approaches I take. Hopefully, you learn to approach things from a different perspective. None of what I am here to teach is difficult, but not all of it is common, and in the later articles we shall see some very exciting cases


