Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-25246: Optimize deque.remove() #23898

Merged
merged 9 commits into from
Dec 23, 2020

Conversation

rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Dec 22, 2020

Alternate PR without an API change. Equivalent to: i = d.index(v); del d[i].

Baseline timing:

$ ./python.exe -m timeit -r 11 -s 'from collections import deque' 'd=deque(range(1000))' 'for i in reversed(range(1000)): d.remove(i)'
50 loops, best of 11: 9.83 msec per loop

Timing with the PR:

$ ./python.exe -m timeit -r 11  -s 'from collections import deque' 'd=deque(range(1000))' 'for i in reversed(range(1000)): d.remove(i)'
50 loops, best of 11: 5.19 msec per loop

https://bugs.python.org/issue25246

@rhettinger rhettinger added the performance Performance or resource usage label Dec 22, 2020
@rhettinger rhettinger requested a review from pablogsal December 22, 2020 21:23
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit bf52c67 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit fff273b 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit a8600ac 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit 34dc45b 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 22, 2020
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 23, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit 357cea5 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 23, 2020
@rhettinger rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 23, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit 039d09d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 23, 2020
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Fantastic job, @rhettinger !

@rhettinger rhettinger merged commit 6b1ac80 into python:master Dec 23, 2020
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants