[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Change by Mark Dickinson :


--
pull_requests: +28493
pull_request: https://github.com/python/cpython/pull/30277

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

Two separate significant improvements have been pushed: thanks, Xinhang Xu!

The original PR also contained a reworking of the general case for 
right-shifting a negative integer. The current code (in main) for that case 
does involve some extra allocations, and it ought to be possible to write 
something that doesn't need to allocate temporary PyLongs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 3581c7abbe15bad6ae08fc38887e5948f8f39e08 by Xinhang Xu in branch 
'main':
bpo-46055: Speed up binary shifting operators (GH-30044)
https://github.com/python/cpython/commit/3581c7abbe15bad6ae08fc38887e5948f8f39e08


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-27 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 360fedc2d2ce6ccb0dab554ef45fe83f7aea1862 by Mark Dickinson in 
branch 'main':
bpo-46055: Streamline inner loop for right shifts (#30243)
https://github.com/python/cpython/commit/360fedc2d2ce6ccb0dab554ef45fe83f7aea1862


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-23 Thread Mark Dickinson


Change by Mark Dickinson :


--
keywords: +patch
pull_requests: +28464
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30243

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-23 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-12 Thread Xinhang Xu


Xinhang Xu  added the comment:

I post a comment to the PR showing its performance improvement. I paste it 
below. I think the result not bad.

-

I use timeit to measure time costs and any other operators or calls are 
excluded. For each testcase, the former is dcd2796 and the latter is this PR's 
base 036bbb1.

64-bit Release building. Run in Windows 10 1709 (64-bit)

python -m timeit " i = 1; i <<= 3; i >>= 3"  # small value (cost down by 36%)
500 loops, best of 5: 92.7 nsec per loop
200 loops, best of 5: 145 nsec per loop

python -m timeit " i = 1; i <<= 10; i >>= 10"  # medium value (-25%)
200 loops, best of 5: 114 nsec per loop
200 loops, best of 5: 151 nsec per loop

python -m timeit " i = 1; i <<= 100; i >>= 100"  # big value  (-12%)
100 loops, best of 5: 209 nsec per loop
100 loops, best of 5: 238 nsec per loop

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Could you please show any microbenchmarking results?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46055] Speed up binary shifting operators

2021-12-11 Thread Xinhang Xu


New submission from Xinhang Xu :

See its PR.

-

Inspired by [bpo-44946](https://bugs.python.org/issue44946), I found there were 
no special shortcuts for shifting operation applied to "medium value" long 
object. So I modified CPython's VM to accelerate my python project where there 
is plenty of binary shifting operation. I guess somebody else might also need 
it.

--
components: Interpreter Core
messages: 408362
nosy: xuxinhang
priority: normal
pull_requests: 28289
severity: normal
status: open
title: Speed up binary shifting operators
type: performance
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com