[issue29724] Itertools docs propose a harmful “speedup” without any explanation

Marc-Andre Lemburg report at bugs.python.org
Sun Mar 5 12:47:35 EST 2017


Marc-Andre Lemburg added the comment:

The localization using keyword parameters is a very old trick to avoid global lookups. It does give a noticeable speedup, esp. when the localized variables are used in tight loops or the function itself is used in such loops.

The 5% speedup Steven measured matches my experience with this trick as well. In some cases, it can provide a more dramatic speedup, but this depends a lot on how the code is written.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29724>
_______________________________________


More information about the Python-bugs-list mailing list