mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-24 05:38:11 +00:00
Adding the Move to Front Hash functionality
Moving a found object to the front of its bucket to reduce the necessary traversal steps to find an object. This change improves the search time on large system with many data or in link lists. (closes issue #19233) Reported by: schmidts Review: https://reviewboard.asterisk.org/r/1201/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@316962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -734,6 +734,10 @@ static void *internal_ao2_callback(struct ao2_container *c,
|
||||
}
|
||||
ast_free(cur); /* free the link record */
|
||||
}
|
||||
if ((match) && (!(flags & OBJ_UNLINK))) {
|
||||
AST_LIST_REMOVE_CURRENT(entry);
|
||||
AST_LIST_INSERT_HEAD(&c->buckets[i], cur, entry);
|
||||
}
|
||||
|
||||
if ((match & CMP_STOP) || !(flags & OBJ_MULTIPLE)) {
|
||||
/* We found our only (or last) match, so force an exit from
|
||||
|
||||
Reference in New Issue
Block a user