Skip to content

GH-147985: Use lock-free lookup in PySet_Contains().#147986

Draft
nascheme wants to merge 2 commits intopython:mainfrom
nascheme:gh-147985-pyset-contains-lockfree
Draft

GH-147985: Use lock-free lookup in PySet_Contains().#147986
nascheme wants to merge 2 commits intopython:mainfrom
nascheme:gh-147985-pyset-contains-lockfree

Conversation

@nascheme
Copy link
Copy Markdown
Member

@nascheme nascheme commented Apr 1, 2026

Make PySet_Contains() attempt a lock-free lookup, similar to set.__contains__(). This avoids acquiring the set object mutex in the normal case.

@nascheme nascheme added type-feature A feature request or enhancement performance Performance or resource usage topic-free-threading labels Apr 1, 2026
@nascheme nascheme changed the title Use lock-free lookup in PySet_Contains(). GH--147985: Use lock-free lookup in PySet_Contains(). Apr 1, 2026
@nascheme nascheme changed the title GH--147985: Use lock-free lookup in PySet_Contains(). GH-147985: Use lock-free lookup in PySet_Contains(). Apr 1, 2026
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge performance Performance or resource usage topic-free-threading type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants