Speedup comparing lists if they happen to be in the same order
This commit is contained in:
parent
62095d916b
commit
7a43c6fee0
1 changed files with 9 additions and 0 deletions
|
@ -525,6 +525,15 @@ int SYMEXPORT alpm_list_cmp_unsorted(const alpm_list_t *left,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* faster comparison for if the lists happen to be in the same order */
|
||||
while(left && fn(left->data, right->data) == 0) {
|
||||
left = left->next;
|
||||
right = right->next;
|
||||
}
|
||||
if(!left) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
matched = calloc(alpm_list_count(right), sizeof(int));
|
||||
|
||||
for(l = left; l; l = l->next) {
|
||||
|
|
Loading…
Add table
Reference in a new issue