add first-place-check to benefit runtime performance
This commit is contained in:
parent
7295cf43f9
commit
c3f83154ad
|
@ -313,6 +313,11 @@ void *taosIterateRef(int rsetId, int64_t rid) {
|
||||||
|
|
||||||
// rid is there
|
// rid is there
|
||||||
pNode = pNode->next;
|
pNode = pNode->next;
|
||||||
|
// check first place
|
||||||
|
while (pNode) {
|
||||||
|
if (!pNode->removed) break;
|
||||||
|
pNode = pNode->next;
|
||||||
|
}
|
||||||
if (pNode == NULL) {
|
if (pNode == NULL) {
|
||||||
taosUnlockList(pSet->lockedBy+hash);
|
taosUnlockList(pSet->lockedBy+hash);
|
||||||
hash++;
|
hash++;
|
||||||
|
@ -323,7 +328,14 @@ void *taosIterateRef(int rsetId, int64_t rid) {
|
||||||
for (; hash < pSet->max; ++hash) {
|
for (; hash < pSet->max; ++hash) {
|
||||||
taosLockList(pSet->lockedBy+hash);
|
taosLockList(pSet->lockedBy+hash);
|
||||||
pNode = pSet->nodeList[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);
|
taosUnlockList(pSet->lockedBy+hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue