3 ms·
Python has a peephole optimizer: https://akaptur.com/blog/2014/08/02/the-cpython-peephole-optimizer-and-you/ https://akaptur.com/blog/2014/08/02/the-cpython-pee
by PaulHoule 2y ago
Python has a peephole optimizer: https://akaptur.com/blog/2014/08/02/the-cpython-peephole-optimizer-and-you/ https://akaptur.com/blog/2014/08/02/the-cpython-peephole-opt...
- maccard 2y agoI think what OP meant was "Python's optimisations are not very fast", which (IMO) is a fair statement. Python is many, many things, but it's best case scenarios (without rewriting in C, at which point you're writing C not python) are slower than the naive implementations in many other languages.
- thesz 2y agoPython optimizations are not deep and/or broad. I did not mean "very fast" as in "compilation speed." Python does not attempt to apply anything more complex than that peephole optimizer, whatever that means. Judging from my experience with Python, that peephole optimizer cannot lift operations on "dictionary with default value" to a regular dictionary operations using conditionals. I had to manually rewrite my program to use conditionals to recover it's speed.