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-45279: avoid redundant _commit_removals self._pending_removals guard #28546

Closed

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Sep 24, 2021

https://bugs.python.org/issue45279

_commit_removals already checks if pending_removals is empty via pop()

def _commit_removals(self):
pop = self._pending_removals.pop
discard = self.data.discard
while True:
try:
item = pop()
except IndexError:
return
discard(item)

@asvetlov
Copy link
Contributor

I believe, the check exists for the sake of performance: condition check is much faster than function call in Python.
Now the gap is smaller than 10 years ago but still relatively big.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Oct 28, 2021
@JelleZijlstra
Copy link
Member

@graingert what do you think? I'd be inclined to close this as the change may hurt performance and there's little clear benefit, so we should default to keeping things as they are.

@asvetlov asvetlov closed this Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review stale Stale PR or inactive for long period of time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants