New submission from theeshallnotknowethme <nohackingofkrow...@gmail.com>:

Optimize calculating powers of 2 for integers. Does not include optimizing 
modular exponentiation because benchmarking shows current version of modular 
exponentiation is faster. Also optimizes any call with the structure 
`l_divmod(a, b, NULL, &mod)`.

> python_modified.exe -m timeit -s "x = 2" "x**10000000"
10000 loops, best of 5: 33.1 usec per loop
> python_current.exe -m timeit -s "x = 2" "x**10000000"
10 loops, best of 5: 35.2 msec per loop

----------
components: Interpreter Core
messages: 410744
nosy: February291948
priority: normal
severity: normal
status: open
title: optimizing `1 << n` or `2 ** n` and modulo-only operations
versions: Python 3.11

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

Reply via email to