Skip to content

[mypyc] Improve support for frozenset #18571

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

Merged
merged 3 commits into from
Jan 31, 2025
Merged

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Jan 30, 2025

Add optimized methods for len and contains on frozenset objects.

@cdce8p cdce8p added the topic-mypyc mypyc bugs label Jan 30, 2025
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks! Frozensets are likely be used in performance critical code, so having better support for them is helpful. Left a few minor comments, overall looks good.

@@ -0,0 +1,536 @@
[case testNewFrozenSet]
Copy link
Collaborator

Choose a reason for hiding this comment

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

The irbuild tests are maybe too verbose -- they may need to be updated frequently as the details of emitter IR change. My suggestion would be to avoid some duplication and to move some thing to run tests if they don't otherwise have test coverage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tbh for the first implementation I mostly copied the set test cases and adjusted them slightly for frozenset. Your suggestion does make sense though. Moved some of the fromIterable tests to run_sets.test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah some of the existing IR build tests are overly verbose.

@JukkaL JukkaL merged commit ce1be2a into python:master Jan 31, 2025
13 checks passed
@cdce8p cdce8p deleted the mypyc-frozenset branch January 31, 2025 16:06
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
Add optimized methods for `len` and `contains` on `frozenset` objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-mypyc mypyc bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants