-
Notifications
You must be signed in to change notification settings - Fork 799
Delete dead code in dict #2014
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
base: unstable
Are you sure you want to change the base?
Delete dead code in dict #2014
Conversation
Signed-off-by: Viktor Söderqvist <[email protected]>
Deletes the following features that are no longer used: * Dict entry with no value * Key as dict entry, when key is odd * Embed key in dict entry Signed-off-by: Viktor Söderqvist <[email protected]>
Signed-off-by: Viktor Söderqvist <[email protected]>
fc077bf
to
b172888
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #2014 +/- ##
============================================
+ Coverage 71.00% 71.17% +0.16%
============================================
Files 123 123
Lines 66103 65906 -197
============================================
- Hits 46939 46909 -30
+ Misses 19164 18997 -167
🚀 New features to boost your workflow:
|
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.
Do you think we can reach to a point where we can completely remove dict by hashtable? I would prefer us leaving the dict.c/dict.h as is till we're ready to remove it completely.
It would take a long time and a lot of work and will not bring a huge benefit. Counting calls to Most or all of them are small and many are short-lived. It's not trivial to replace them with hashtable since they need an key-value entry object. I'm considering replacing the internals of dict so it uses hashtable internally with a dictEntry being just a key and a value (no next pointer). But to do that, I'd like to shrink the dict API as much as possible first. What do you think of this plan? |
Sounds like a plan. I was trying to look internally if this will have implications. Shall we do the changes you're suggesting in a single PR with multiple commits? |
Yes, please do. There is more unused stuff that I kept because it's very small and we (or you) might want to use it still.
This PR has 3 separate commits. We can merge without squashing if you want. Also, when you backport this to AWS, you can just skip this PR? |
I'm worried about the next set of PRs. It becomes difficult to track which changes were related to each other. Hence, I was asking if it can be done in a single go in this PR. |
@hpatro Which next set of PRs? I don't have anything in the near future. Are you referring using hashtable as the backend for dict? I don't know if it is as easy as it seems, but to do that, it seems good to shrink the unused dict APIs as much as possible before. Doesn't it?
I did get rid of the usage of TBH, I don't understand why you're so concerned about deleting dead code. The hashtable is basically a dict with a user-defined dictEntry, which should obsolete the hacks to manipulate the dictEntry, a struct that should be internal to dict. Can you check if you're using any of this in AWS? Then we can perhaps keep it for now, but we can delete the rest of the dead code? |
We use the dictionary code internally in few places, so quite possible those benefit from the optimisation which we had introduced and suddenly it could see regression in memory utilisation by reverting these enhancements. I agree with all of your above points. I think it makes sense for Valkey to cleanup unused code. Just trying to see if we can do it with minimal impact to downstream repositories.
I'm doing this as we speak. Let me get back soon. |
After transitioning much usage of dict to the new hashtable, parts of the dict implementation have become dead code. The following is deleted: