[issue29782] Use __builtin_clzl for bits_in_digit if available

2020-06-08 Thread Niklas Fiekas
Change by Niklas Fiekas : -- pull_requests: +19946 pull_request: https://github.com/python/cpython/pull/20739 ___ Python tracker <https://bugs.python.org/issue29

[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2020-05-30 Thread Niklas Fiekas
Change by Niklas Fiekas : -- nosy: +niklasf ___ Python tracker <https://bugs.python.org/issue19915> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35721] _UnixSubprocessTransport leaks socket pair if Popen fails

2019-01-14 Thread Niklas Fiekas
Change by Niklas Fiekas : -- keywords: +patch, patch, patch pull_requests: +11184, 11185, 11186 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35721] _UnixSubprocessTransport leaks socket pair if Popen fails

2019-01-14 Thread Niklas Fiekas
Change by Niklas Fiekas : -- keywords: +patch, patch pull_requests: +11184, 11185 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35721] _UnixSubprocessTransport leaks socket pair if Popen fails

2019-01-14 Thread Niklas Fiekas
Change by Niklas Fiekas : -- keywords: +patch pull_requests: +11184 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35721> ___ ___ Py

[issue35721] _UnixSubprocessTransport leaks socket pair if Popen fails

2019-01-11 Thread Niklas Fiekas
New submission from Niklas Fiekas : Output of attached test case: non-existing indeed subprocess-exec-test.py:11: ResourceWarning: unclosed print("non-existing indeed") ResourceWarning: Enable tracemalloc to get the object allocation traceback subprocess-exec-test.py:11: Resou

[issue31031] Unify duplicate bits_in_digit and bit_length

2017-07-25 Thread Niklas Fiekas
Changes by Niklas Fiekas <niklas.fie...@backscattering.de>: -- pull_requests: +2916 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue31031] Unify duplicate bits_in_digit and bit_length

2017-07-25 Thread Niklas Fiekas
New submission from Niklas Fiekas: My previous patch to optimize bits_in_digit was rejected: http://bugs.python.org/issue29782 This leaves this issue open (mathmodule.c): /* XXX: This routine does more or less the same thing as * bits_in_digit() in Objects/longobject.c. Someday it would

[issue29936] Typo in __GNU*C*_MINOR__ guard affecting gcc 3.x

2017-03-28 Thread Niklas Fiekas
Changes by Niklas Fiekas <niklas.fie...@backscattering.de>: -- components: +Build -Interpreter Core nosy: +Jeffrey.Armstrong, christian.heimes type: -> compile error ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue29936] Typo in __GNU*C*_MINOR__ guard affecting gcc 3.x

2017-03-28 Thread Niklas Fiekas
Changes by Niklas Fiekas <niklas.fie...@backscattering.de>: -- pull_requests: +777 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29936] Typo in __GNU*C*_MINOR__ guard affecting gcc 3.x

2017-03-28 Thread Niklas Fiekas
New submission from Niklas Fiekas: The patch in http://bugs.python.org/issue16881 disables the nicer macro for gcc 3.x due to a small typo. The build is not failing. The guard just unnescessarily evaluates to false. -- components: Interpreter Core messages: 290738 nosy: niklasf

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
Niklas Fiekas added the comment: Searching popcount in Python files on GitHub yields a considerable number of examples: https://github.com/search?utf8=%E2%9C%93=popcount+extension%3Apy=Code Perhaps intresting: * In CPython itself: See count_set_bits in Modules/mathmodule.c * Domain

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
Changes by Niklas Fiekas <niklas.fie...@backscattering.de>: -- pull_requests: +678 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
New submission from Niklas Fiekas: An efficient popcount (something equivalent to bin(a).count("1")) would be useful for numerics, parsing binary formats, scientific applications and others. DESIGN DECISIONS * Is a popcount method useful enough? * How to handle negative values? *

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-10 Thread Niklas Fiekas
Niklas Fiekas added the comment: Oops. Actually clz should commonly be enough. And platforms where clz and clzl are different (<=> unsigned int and unsigned long are different) should be rare. -- ___ Python tracker <rep...@bugs.python.o

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-10 Thread Niklas Fiekas
Niklas Fiekas added the comment: Thanks for the review. I pushed a change to check if clz can be used (`sizeof(digit) <= sizeof(unsigned int)`). Otherwise use clzl. I believe the latter should be the most common, since unsigned long has 32bits. As you say unsigned long long should ne

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-10 Thread Niklas Fiekas
Changes by Niklas Fiekas <niklas.fie...@backscattering.de>: -- pull_requests: +490 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-03-10 Thread Niklas Fiekas
New submission from Niklas Fiekas: Baseline performance (9e6ac83acae): $ ./python -m timeit "12345678 == 12345678.0" 500 loops, best of 5: 40 nsec per loop $ ./python -m timeit "1 == 1.0" 1000 loops, best of 5: 38.8 nsec per loop $ ./python -m timeit "(123