New submission from Serhiy Storchaka: The proposed patch adds a fast patch for generating small integers (the most common use case).
Microbenchmark: $ ./python -m timeit -s "import random; r=random.getrandbits; n=30" "r(n);r(n);r(n);r(n);r(n);r(n);r(n);r(n);r(n);r(n)" Non patched: 4.27 usec per loop Patched: 2.97 usec per loop ---------- components: Extension Modules files: random_getrandbits_fastpath.patch keywords: patch messages: 177436 nosy: mark.dickinson, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Faster getrandbits() for small integers type: performance versions: Python 3.4 Added file: http://bugs.python.org/file28304/random_getrandbits_fastpath.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16674> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com