Skip to content

Optimize dictExpand of empty dict#12847

Merged
soloestoy merged 1 commit intoredis:unstablefrom
lyq2333:free-dict-when-empty
Dec 8, 2023
Merged

Optimize dictExpand of empty dict#12847
soloestoy merged 1 commit intoredis:unstablefrom
lyq2333:free-dict-when-empty

Conversation

@lyq2333
Copy link
Contributor

@lyq2333 lyq2333 commented Dec 8, 2023

If a dict is empty before dictExpand, we don't need to do rehashing actually. We can just create a new dict and set it as ht_table[0] to skip incremental rehashing and free the memory quickly.

With this PR, I think we can resize empty dicts in tryResizeHashTables as introduced in #12819.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants