From: SourceForge.net <no...@so...> - 2011-03-07 17:20:29
|
Patches item #3195537, was opened at 2011-02-28 22:40 Message generated for change (Comment added) made by bvassche You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3195537&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Stephen Hemminger () Assigned to: Nobody/Anonymous (nobody) Summary: binary_array container sort optimization Initial Comment: Put the simple comparison of index before the more costly comparison function when evaluating conditionals ---------------------------------------------------------------------- >Comment By: (bvassche) Date: 2011-03-07 18:20 Message: Applied as r20077 on the trunk and the 5.6 branch - thanks for the patch. ---------------------------------------------------------------------- Comment By: (bvassche) Date: 2011-03-02 08:10 Message: What I would prefer (if this makes sense) is to replace the array used by the container_binary_array.c implementation by a red-black tree. Inserting in and removing from a red-black tree is much more scalable than resorting an array upon every insertion and removal. Is there a BSD-licensed red-black tree implementation available somewhere ? ---------------------------------------------------------------------- Comment By: (bvassche) Date: 2011-03-01 21:04 Message: I would also prefer to see the qsort() function provided by the C library to be invoked here. Unfortunately the function type netsnmp_container_compare is not what qsort() expects: functions of type netsnmp_container_compare are passed an element of array "data" while qsort() passes pointers to elements of array "data" to its comparison function. ---------------------------------------------------------------------- Comment By: Magnus Fromreide (magfr) Date: 2011-03-01 00:40 Message: I think this is a false optimization. i is the lower limit so it will only be true once we are down to a single element range and that should preferably not happen. Now, the real question is probably why we are using a homebrew qsort instead of the standard library implementation. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3195537&group_id=12694 |