dbScan: optimize addToList
Insert from back to maintain ~same order. Avoid iterating entire list each time in the common case where all PHAS==0
This commit is contained in:
committed by
Ralph Lange
parent
b392c1ca7d
commit
56d5a59356
@@ -940,9 +940,9 @@ static void addToList(struct dbCommon *precord, scan_list *psl)
|
||||
pse->precord = precord;
|
||||
}
|
||||
pse->pscan_list = psl;
|
||||
ptemp = (scan_element *)ellFirst(&psl->list);
|
||||
ptemp = (scan_element *)ellLast(&psl->list);
|
||||
while (ptemp) {
|
||||
if (ptemp->precord->phas > precord->phas) {
|
||||
if (ptemp->precord->phas <= precord->phas) {
|
||||
ellInsert(&psl->list, ellPrevious(&ptemp->node), &pse->node);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user