[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread STINNER Victor
STINNER Victor added the comment: Ok, thanks. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ _

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Oren Milman added the comment: the pull request was merged, so I guess we can close this issue.. -- ___ Python tracker ___ ___ Python-

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread STINNER Victor
STINNER Victor added the comment: > To sum it up, my patch degrades performance for ints smaller than > (approximately) 10 ** 150, and improves performance for bigger ints. IMHO Python language mostly handles integers smaller than 1 million, so the optimization is not a good idea :-) I had th

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Oren Milman added the comment: I created a pull request (https://github.com/python/cpython/pull/392) to fix the mistakes in _testcapimodule, but didn't mention this issue in the pull request's title, as the issue mentioned these mistakes only as a side note. -- _

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2017-03-02 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +323 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-09-23 Thread Oren Milman
Changes by Oren Milman : -- versions: +Python 3.7 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43435/proposedPatches.diff ___ Python tracker ___ ___ Python-bugs-list mailing

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43434/badMicroBenchProposedPatches.diff ___ Python tracker ___ ___ Python-bugs

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-17 Thread Oren Milman
Oren Milman added the comment: I did some micro-benchmarking, and it looks like bad news for my patch. I wrote a simple C extension in order to call PyLong_AsUnsignedLongMask and PyLong_AsUnsignedLongLongMask from Python code (attached). Then I ran the following micro-benchmarks using both the

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-14 Thread Oren Milman
Oren Milman added the comment: Ah, that's a cool alternative to divide and ceil. I would change my patch accordingly. And would write the patch also for _PyLong_AsUnsignedLongLongMask, and work on some micro-benchmarking for it and _PyLong_AsUnsignedLongMask. Indeed _testcapimodule.c is not r

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The accurate number of digits is (sizeof(x) * 8 + PyLong_SHIFT - 1) / PyLong_SHIFT or (sizeof(x) * 8 - 1) / PyLong_SHIFT + 1. There is a similar code in _PyLong_AsUnsignedLongLongMask(). Changes of Modules/_testcapimodule.c look not related to the implementa

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43347/patchedCPythonTestOutput.txt ___ Python tracker ___ ___ Python-bugs-list

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +mark.dickinson, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
New submission from Oren Milman: current state 1. In Objects/longobject.c in _PyLong_AsUnsignedLongMask, in case v is a multiple-digit int, _PyLong_AsUnsignedLongMask iterates over all of its digits (going from the most to the least significant digit) and does (for eac

[issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask

2016-06-11 Thread Oren Milman
Changes by Oren Milman : Added file: http://bugs.python.org/file43348/CPythonTestOutput.txt ___ Python tracker ___ ___ Python-bugs-list mailin