New submission from Armin Rigo: The attached patch (which can be applied on both trunk and 2.7) gives a huge speed improvement for the case 'pow(huge_number, smallish_number, smallish_number)'. The improvement is unbounded: I get 20x with 'pow(x, y, z)' with the arguments 'x = 3 ** 10000, y = 10 ** 51 - 2, z = 10 ** 51' but increasing x just increases the factor.
This is inspired by https://github.com/pyca/ed25519: check out revision 9f3e838d90ded42a86ec74c5e9f5e37dec8122a0, run it with 'time python -u signfast.py < sign.input'. This patch gives around 14% improvement. So it's a case that occurs in practice. ---------- components: Interpreter Core files: pow_speedup.diff keywords: patch messages: 198987 nosy: arigo priority: normal severity: normal status: open title: pow() improvement on longs versions: Python 2.7, Python 3.4 Added file: http://bugs.python.org/file31964/pow_speedup.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19171> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com