Unverified Commit 678e67b5 authored by DarrenJiang13's avatar DarrenJiang13 Committed by GitHub
Browse files

presize hashtable to avoid rehashing when hashTypeConvertZiplist() (#8943)

parent b1099773
...@@ -470,6 +470,9 @@ void hashTypeConvertZiplist(robj *o, int enc) { ...@@ -470,6 +470,9 @@ void hashTypeConvertZiplist(robj *o, int enc) {
hi = hashTypeInitIterator(o); hi = hashTypeInitIterator(o);
dict = dictCreate(&hashDictType, NULL); dict = dictCreate(&hashDictType, NULL);
/* Presize the dict to avoid rehashing */
dictExpand(dict,hashTypeLength(o));
while (hashTypeNext(hi) != C_ERR) { while (hashTypeNext(hi) != C_ERR) {
sds key, value; sds key, value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment