-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] feat: true_dict_rprimitive for optimized dict fastpath usage #19499
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
Open
BobTheBuidler
wants to merge
49
commits into
python:master
Choose a base branch
from
BobTheBuidler:truedictprimitive
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
c5a11a1
feat: true dict rprimitive
BobTheBuidler d1cedf0
fix: ordered dict
BobTheBuidler 8649798
fix: mypy errs
BobTheBuidler 34501b1
fix: mypy errs
BobTheBuidler a09bc0d
fix: mypy errs
BobTheBuidler 7f75ce5
fix: mypy errs
BobTheBuidler e0f162f
feat: use true_dict_rprimitive for builtins.dict
BobTheBuidler 2297bd3
fix: mypy errs
BobTheBuidler 3208af0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] dda49ff
fix: mypy errs
BobTheBuidler 14c4e78
fix: clear ers never
BobTheBuidler 311a466
fix: err kind
BobTheBuidler fc762c2
fix: err kind
BobTheBuidler 6c697df
fix: err kind
BobTheBuidler 6ac41c3
chore: rename true dict to exact dict
BobTheBuidler b28057e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6979824
chore: rename true_dict ops to exact_dict
BobTheBuidler 3501cdb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6054288
Update mapper.py
BobTheBuidler e3fde02
update ir
BobTheBuidler efbba27
update ir
BobTheBuidler ee8da40
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ba74ed0
update ir
BobTheBuidler ccbfe6e
Merge branch 'master' into truedictprimitive
BobTheBuidler 8d7de98
Update ll_builder.py
BobTheBuidler a51a3c1
Update misc_ops.py
BobTheBuidler 9b5f28f
Merge branch 'master' into truedictprimitive
BobTheBuidler 1c74d33
Merge branch 'master' into truedictprimitive
BobTheBuidler 8d6981d
Update dict_ops.py
BobTheBuidler 6c0814a
Update dict_ops.py
BobTheBuidler 46ebf29
Update irbuild-generics.test
BobTheBuidler 6fcfb90
Update irbuild-generics.test
BobTheBuidler 5528791
Update rt_subtype.py
BobTheBuidler 34ab0b8
Update subtype.py
BobTheBuidler 3e3fd30
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 64a8cb0
Update subtype.py
BobTheBuidler 03419ee
Update dict_ops.py
BobTheBuidler 394ebe2
Update dict_ops.py
BobTheBuidler 5aba93d
Update dict_ops.py
BobTheBuidler b18640f
Update dict_ops.py
BobTheBuidler be813b2
Update dict_ops.py
BobTheBuidler fba7466
Update ircheck.py
BobTheBuidler 814d3e4
update it
BobTheBuidler d33991e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bcac8e7
update it
BobTheBuidler dc8d01c
Merge branch 'truedictprimitive' of https://github.com/BobTheBuidler/…
BobTheBuidler a076268
Merge branch 'master' into truedictprimitive
BobTheBuidler 0050b5c
Merge branch 'master' into truedictprimitive
BobTheBuidler f113166
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could generalize this to other types by adding an
is_exact
attribute toRPrimitive
. Not sure whether it's worth it though --dict
is likely the one that will likely benefit the most from this.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when I was setting this up originally, I noticed that
dict
is unique in that we specialize operations on subclasses by considering all of them instances of dict_rprimitive. We don't currently do that for subclasses of other primitive types, but with the addition of this flag we easily could.I think that reason alone might make it worthwhile. Then we can support faster ops for cases like the first class in the below example, without breaking the second class in the example.
Example with
str.lower
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking a few steps ahead here of course, but the is_exact flag would be a critical first step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JukkaL before I start thinking on how to implement this attribute (it will involve a decent amount of refactoring for this PR) are there any specs/requirements you want me to keep in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably better to add add the generalization later on, after we understand the different use cases better. We can add the generalization before we start adding other exact types (and this could be much later). It's not even clear how helpful other exact types would be -- maybe exact list and tuple types could be useful.