Add: Struct dict function variant#4
Merged
ashvardanian merged 2 commits intoashvardanian:mainfrom Jan 27, 2025
jmg-duarte:main
Merged
Add: Struct dict function variant#4ashvardanian merged 2 commits intoashvardanian:mainfrom jmg-duarte:main
ashvardanian merged 2 commits intoashvardanian:mainfrom
jmg-duarte:main
Conversation
Owner
|
This is epic! Thank you, @jmg-duarte! And special thanks for matching the commit message style! Your explanation and the bytecode snippets are amazing. Can I ask you to add them to the source code as a |
Contributor
Author
|
@ashvardanian done, let me know if/what I should change! |
ashvardanian
approved these changes
Jan 27, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Great resource!
I was reading through and wanted to add my two cents on the dict benchmark.
There's a difference between calling
dictvs{}, for the first one, Python needs to lookupdictwhile the{}nomenclature cannot be overwritten, the bytecode says it all — https://godbolt.org/z/4497dfTG1{}dictI was curious to see how they stack up, turns out, the difference is big enough that it can almost close the gap to the dataclass and friends — see
test_structs_dict_funI'm not sure if this is the content you're looking for but since you had other libraries, I think this could be an interesting find too.
I didn't add the takeaways to the file itself since I didn't get values near to yours, but I can add them if you want!