[New-bugs-announce] [issue26342] Faster bit ops for single-digit positive longs

Yury Selivanov report at bugs.python.org
Thu Feb 11 14:33:58 EST 2016


New submission from Yury Selivanov:

This patch implements a fast path for &, |, and ^ bit operations for single-digit positive longs.  We already have fast paths for ~, and pretty much every other long op.


-m timeit -s "x=21827623" "x&2;x&2;x&2;x&333;x&3;x&3;x&4444;x&4"
with patch: 0.181          without patch: 0.403


-m timeit -s "x=21827623" "x|21222;x|23;x|2;x|333;x|3;x|3;x|4444;x|4"
with patch: 0.241          without patch: 0.342


-m timeit -s "x=21827623" "x^21222;x^23;x^2;x^333;x^3;x^3;x^4444;x^4"
with patch: 0.241          without patch: 0.332

----------
assignee: yselivanov
components: Interpreter Core
files: fast_bits.patch
keywords: patch
messages: 260126
nosy: haypo, mark.dickinson, serhiy.storchaka, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Faster bit ops for single-digit positive longs
type: performance
Added file: http://bugs.python.org/file41901/fast_bits.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26342>
_______________________________________


More information about the New-bugs-announce mailing list