[issue45976] Random._randbelow() loses time by caching an attribute lookup

Raymond Hettinger report at bugs.python.org
Fri Dec 3 23:06:10 EST 2021


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I just did a few timings using the stock python.org Mac builds.  Only Python 3.10 gave the expected speed-up.  Python 3.8 and Python 3.9 got slower.  Python 3.11 was slightly slower.

I think we should pass on this proposed change.  The current code is safer in that it has been consistently good while the proposed change is inconsistent and can't be relied upon across builds.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45976>
_______________________________________


More information about the Python-bugs-list mailing list