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 <rep...@bugs.python.org> <http://bugs.python.org/issue26342> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com