From 423565f7849a955cba4cce1cd1162e86c36319a3 Mon Sep 17 00:00:00 2001 From: lyq2333 <50293466+lyq2333@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:50:09 +0800 Subject: [PATCH] Optimize CPU cache efficiency on dict while rehashing in dictTwoPhaseUnlinkFind (#12818) In #5692, we optimize CPU cache efficiency on dict while rehashing but missed the modification in dictTwoPhaseUnlinkFind. This PR supplements it. --- src/dict.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dict.c b/src/dict.c index 66a9bf951..e88a843cc 100644 --- a/src/dict.c +++ b/src/dict.c @@ -718,6 +718,7 @@ dictEntry *dictTwoPhaseUnlinkFind(dict *d, const void *key, dictEntry ***plink, for (table = 0; table <= 1; table++) { idx = h & DICTHT_SIZE_MASK(d->ht_size_exp[table]); + if (table == 0 && (long)idx < d->rehashidx) continue; dictEntry **ref = &d->ht_table[table][idx]; while (ref && *ref) { void *de_key = dictGetKey(*ref);