mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
faster Set loading time from .rdb file resizing the hash table to the right size before loading elements
This commit is contained in:
parent
9651a78787
commit
3c68de9b01
4
redis.c
4
redis.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user