-
Notifications
You must be signed in to change notification settings - Fork 171
Initial support for dict
data structure
#975
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
Conversation
@certik This is ready for review. I have mentioned my TODOs after this PR in #983 (comment). You can review each commit individually if you want. Let me know if anything needs a change here. |
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 reviewed every commit, everything looks great.
My only possible question is if the CPython version of the test takes a long time, if so, we should reduce the number of loop iterations in the test.
That can be adjusted later.
So +1 to merge.
Great job!
@czgdp1807 is this ordered or unordered dictionary? |
I think this is unordered dictionary (because hash maps are unordered in nature). For ordered dictionary we will require an implementation similar to std::map. Though you can make ordered dictionary out of unordered ones by subclassing and tracking the insertion order of keys. I would keep both ordered and unordered ones as one has some advantages over the other. |
Here is another way to implement OrderedDict: https://github.com/Aqcurate/OrderedDict#ordered-dictionary-implementation |
Closes #964
Following is the plan,
dict
with the help of a struct in LLVM. Maintain original key-value pairs for the purpose of collision handling and in case a collision happens then distinguishing between update and insert operation. We need original key-value pairs anyways for all kinds of collision handling strategy.TODOs after this PR - #983 (comment)