Revision: 44892
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44892&view=rev
Author:   bhinesley
Date:     2011-06-10 19:44:19 +0000 (Fri, 10 Jun 2011)

Log Message:
-----------
Adding '-sorted' to lsearch's in few places where it's clear that the given 
list was A) sorted '-increasing' B) sorted as ASCII text C) was not modified 
before the search D) not sorted with any of '-all'/'-not'/'-glob'/'-regexp'. 
This option results in increased performance, since it forces lsearch to do a 
binary search, rather than the default linear search.

Of all 58 instances of lsort in BRL-CAD tcl scripts that were inspected, only 3 
obvious cases of missing 'lsearch -sorted' options were found following them.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/archer/Archer.tcl
    brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl

Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl       2011-06-10 19:03:37 UTC 
(rev 44891)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl       2011-06-10 19:44:19 UTC 
(rev 44892)
@@ -2616,7 +2616,7 @@
 
     # If an item is in both sublists, remove it from mlist.
     foreach item $klist {
-       set l [lsearch -all $mlist $item]
+       set l [lsearch -all -sorted $mlist $item]
        set l [lsort -decreasing $l]
        foreach i $l {
            # Delete the item (i.e. it no longer exists)
@@ -2750,7 +2750,7 @@
        set mSelectedObj $new_name
        checkpoint $mSelectedObj $LEDGER_MODIFY
        regsub {([^/]+)$} $mSelectedObjPath $new_name mSelectedObjPath
-    } elseif {[lsearch $mlist $mSelectedObj] != -1} {
+    } elseif {[lsearch -sorted $mlist $mSelectedObj] != -1} {
        checkpoint $mSelectedObj $LEDGER_MODIFY
     }
 

Modified: brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl        2011-06-10 
19:03:37 UTC (rev 44891)
+++ brlcad/trunk/src/tclscripts/archer/CombEditFrame.tcl        2011-06-10 
19:44:19 UTC (rev 44892)
@@ -794,7 +794,7 @@
     # Is the cell indicated by _index empty?
     set tname [lindex $mMemberDataOrder $_type]
     set anames [lsort -dictionary [array names mMemberData$tname]]
-    set i [lsearch $anames $_index]
+    set i [lsearch -sorted $anames $_index]
     if {$i == -1} {
        set cellEmpty 1
     } else {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to