Careful how you use DISTINCT or ORDER BY on very large tables. You might want to reevaluate (after checking if there's a problem of course).
Excellent piece diving deep into the opportunities to optimise an algorithm. The final speed up is impressive.
Interesting trick to detect table scans with SQLite. I can see that useful in development to optimize systems.
These are good rules. Take inspiration from them.
Here are the main levers to make Python code faster. Tries also to distinguish the effort level of each approach.
Yes, Rust like C++ comes with zero cost abstractions. Still they can get in the way of some compiler optimisations. This is an interesting case preventing vectorisation.
Interesting insights from optimisations done on the Quake engine almost thirty years ago.
If you needed a reminder that inlining functions isn't necessarily an optimisation, here is a fun little experiment.