Add fast path in count_elements by rhettinger · Pull Request #120983 · python/cpython · GitHub
Skip to content

Add fast path in count_elements - #120983

Merged
rhettinger merged 1 commit into
python:mainfrom
rhettinger:count_elements
Jun 25, 2024
Merged

rhettinger merged 1 commit into
python:mainfrom
rhettinger:count_elements

Conversation

@rhettinger

Copy link
Copy Markdown
Contributor

A common case is that bound get() returns the default. In this case, the addition step can be skipped because we already know the result.

@rhettinger rhettinger added performance Performance or resource usage skip issue skip news labels Jun 25, 2024
@rhettinger rhettinger self-assigned this Jun 25, 2024
@rhettinger
rhettinger merged commit 9b32b89 into python:main Jun 25, 2024
@rhettinger
rhettinger deleted the count_elements branch June 25, 2024 08:10
@eendebakpt

eendebakpt commented Jun 25, 2024

Copy link
Copy Markdown
Contributor

mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage skip issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants