-
Notifications
You must be signed in to change notification settings - Fork 1k
Optimize SREM/ZREM/HDEL to pause auto shrink when deleting multiple items #3144
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
When ZREM and SREM delete a large number of elements, we can apply the same optimization as ZREMRANGEBY*, which is to temporarily pause the autoshrink of the corresponding hashtable to avoid triggering resize/rehash repeatedly during the deletion process. This theoretically leads to some performance improvements. Furthermore, by only triggering a resize once at the end (i.e., only when `hashtableResumeAutoShrink` is called), we can get the most right resize, preventing further resizes during the resize/rehash process. Signed-off-by: Binbin <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #3144 +/- ##
============================================
+ Coverage 74.85% 74.87% +0.02%
============================================
Files 129 129
Lines 71210 71215 +5
============================================
+ Hits 53302 53322 +20
+ Misses 17908 17893 -15
🚀 New features to boost your workflow:
|
dvkashapov
left a comment
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.
Overall LGTM, clean and simple
Co-authored-by: Daniil Kashapov <[email protected]> Signed-off-by: Binbin <[email protected]>
Signed-off-by: Binbin <[email protected]>
Signed-off-by: Binbin <[email protected]>
Signed-off-by: Binbin <[email protected]>
zuiderkwast
left a comment
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.
Yes, this is better, without behavior change.
For release notes, we can say something like "optimize srem/zrem/hdel when deleting multiple items".
When ZREM / SREM / HDEL delete a large number of elements, we can apply the same
optimization as ZREMRANGEBY*, which is to temporarily pause the autoshrink of
the corresponding hashtable to avoid triggering resize/rehash repeatedly during
the deletion process.
This theoretically leads to some performance improvements. Furthermore, by only
triggering a resize once at the end (i.e., only when
hashtableResumeAutoShrinkis called), we can get the most right resize, preventing further resizes during
the resize/rehash process.