[asterisk-commits] schmidts: trunk r316962 - /trunk/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 5 02:09:28 CDT 2011


Author: schmidts
Date: Thu May  5 02:09:20 2011
New Revision: 316962

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316962
Log:
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/


Modified:
    trunk/main/astobj2.c

Modified: trunk/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/astobj2.c?view=diff&rev=316962&r1=316961&r2=316962
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Thu May  5 02:09:20 2011
@@ -734,6 +734,10 @@
 				}
 				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




More information about the asterisk-commits mailing list