One long-standing piece of conventional wisdom that shouldn't be left unmentioned is the advice that when you run into a performance bottleneck, you should recode in a low-level language. If you're coding in C++, the low-level language might be assembler. If you're coding in Python, the low-level language might be C. Recoding in a lowlevel language tends to improve both speed and code size. Here is a typical approach to optimizing with a low-level language:
Write 100 percent of an application in a high-level language.
Fully test the application, and verify that it's correct.
If performance improvements are needed after that, profile the application to identify hot spots. Since about 5 percent of a program usually ...