-
Notifications
You must be signed in to change notification settings - Fork 756
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
Replaced temp dicts with hashtable in hrandfieldWithCountCommand. #1793
base: unstable
Are you sure you want to change the base?
Replaced temp dicts with hashtable in hrandfieldWithCountCommand. #1793
Conversation
Signed-off-by: Shai Zarka <[email protected]>
da5d9a1
to
d0bf28c
Compare
Signed-off-by: Shai Zarka <[email protected]>
…cts_with_hashtable
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1793 +/- ##
============================================
- Coverage 71.06% 71.05% -0.02%
============================================
Files 123 123
Lines 65671 65665 -6
============================================
- Hits 46669 46655 -14
- Misses 19002 19010 +8
🚀 New features to boost your workflow:
|
update - |
Signed-off-by: Shai Zarka <[email protected]>
/* Add all the elements into the temporary hashtable. */ | ||
while (hashTypeNext(&hi) != C_ERR) { | ||
int ret = 0; | ||
ret = hashtableAdd(ht, (&hi)->next); |
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.
why not
ret = hashtableAdd(ht, hi.entry);
?
This code can be reduce to:
while (hashTypeNext(&hi) != C_ERR) {
serverAssert(hashtableAdd(ht, hi.next));
}
if (withvalues && c->resp > 2) addWritePreparedReplyArrayLen(wpc, 2); | ||
addWritePreparedReplyBulkSds(wpc, field); | ||
if (withvalues) addWritePreparedReplyBulkSds(wpc, value); | ||
addWritePreparedReplyBulkSds(wpc, sdsdup(field)); |
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.
Consider removing addWritePreparedReplyBulkSds and use addReplyBulkCBuffer instead, no sdsdup is needed
This PR resolves #1550 by replacing the use of temporary dict structures with hashtable in
hrandfieldWithCountCommand
.Notes:
CASE 3: Replaced sdsReplyDictType with hashHashtableType to efficiently store field-value pairs using hashTypeEntry.
CASE 4: Replaced hashDictType with setHashtableType, as only the field needs to be stored.