Hacker News new | ask | show | jobs
by sgarland 972 days ago
What I’ve found most helpful for understanding how something affects Python specifically (but this holds true for nearly any language) is godbolt [0].

Find a chunk of code you want to optimize, simplify it as much as possible, then put it into godbolt. Match the interpreter version to yours. Then go look up the bytecodes and see what they do. Try changing the Python version to see how it differs, or a different approach to the problem (e.g. a map instead of a list comprehension).

This takes an enormous amount of time, of course, but you can learn quite a bit.

[0]: https://godbolt.org