提交 3c68de9b 编写于 作者: A antirez

faster Set loading time from .rdb file resizing the hash table to the right...

faster Set loading time from .rdb file resizing the hash table to the right size before loading elements
上级 9651a787
......@@ -3335,6 +3335,10 @@ static robj *rdbLoadObject(int type, FILE *fp) {
if ((listlen = rdbLoadLen(fp,NULL)) == REDIS_RDB_LENERR) return NULL;
o = (type == REDIS_LIST) ? createListObject() : createSetObject();
/* It's faster to expand the dict to the right size asap in order
* to avoid rehashing */
if (type == REDIS_SET && listlen > DICT_HT_INITIAL_SIZE)
dictExpand(o->ptr,listlen);
/* Load every single element of the list/set */
while(listlen--) {
robj *ele;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册