add first-place-check to benefit runtime performance

This commit is contained in:
freemine 2021-01-29 13:51:05 +08:00
parent 7295cf43f9
commit c3f83154ad
1 changed files with 13 additions and 1 deletions

View File

@ -313,6 +313,11 @@ void *taosIterateRef(int rsetId, int64_t rid) {
// rid is there
pNode = pNode->next;
// check first place
while (pNode) {
if (!pNode->removed) break;
pNode = pNode->next;
}
if (pNode == NULL) {
taosUnlockList(pSet->lockedBy+hash);
hash++;
@ -323,7 +328,14 @@ void *taosIterateRef(int rsetId, int64_t rid) {
for (; hash < pSet->max; ++hash) {
taosLockList(pSet->lockedBy+hash);
pNode = pSet->nodeList[hash];
if (pNode) break;
if (pNode) {
// check first place
while (pNode) {
if (!pNode->removed) break;
pNode = pNode->next;
}
if (pNode) break;
}
taosUnlockList(pSet->lockedBy+hash);
}
}