[issue18005] faster modular exponentiation in some cases

2013-06-04 Thread Aaron Meurer
Changes by Aaron Meurer : -- nosy: +Aaron.Meurer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue18005] faster modular exponentiation in some cases

2013-05-18 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry, I'm rejecting this. This sort of micro-optimization for a little-used operation doesn't belong in Python. For applications that need it, use gmpy2. -- resolution: -> rejected status: open -> closed ___ Pyth

[issue18005] faster modular exponentiation in some cases

2013-05-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +eric.smith, lemburg, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach versions: +Python 3.4 -Python 2.7 ___ Python tracker ___ ___

[issue18005] faster modular exponentiation in some cases

2013-05-18 Thread Pernici Mario
New submission from Pernici Mario: A trivial optimization can be made in ``pow(a, b, c)`` if ``b`` is even and ``c - a < a`` ``` In [1]: c = (1 << 100) + 1 In [2]: a = c - 1234567 In [3]: b = 2 In [4]: %timeit pow(a, b, c) 1 loops, best of 3: 3.03 s per loop In [5]: %timeit pow(c - a if