330× faster: Four different ways to speed up your code

Note: The original version of this article was slightly different, e.g. with 500x speedup; I reworked it to make the argument clearer.
If your Python code is slow and needs to be fast, there are many
different approaches you can take, from parallelism to writing a
compiled extension. But if you just stick to one approach, it’s easy to
miss potential speedups, and end up with code that is much slower than
it could be.
To make sure you’re not forgetting potential sources of speed, it’s
useful to think in terms of practices. Each practice:
- Speeds up your code in its own unique way.
- Involves distinct skills and knowledge.
- Can be applied on its own.
- Can also be applied together with other practices for even