Andrew Lin <onethreese...@gmail.com> added the comment:

Timings are unaffected by updating to non-walrus, so I'll do so in the PR.

Using _randbelow_without_getrandbits() I get 5% improvement to sample([None] * 
2047, 50); 6% to shuffle([None] * 2000); and approximately 6% to randrange() 
for any number significantly less than 2**32.  It's not surprising that the 
absolute speedup is smaller, because _randbelow_without_getrandbits() does a 
lot more work that is untouched by the change.  On the other hand, the speedup 
is more consistent, since _randbelow_without_getrandbits(n) almost never calls 
random() more than once for any n significantly less than 2**32.

I will clean up my benchmark script and post it.

Thanks for the feedback!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45976>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to