Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bb677bda26ce2e7d36d9a209b90cafffc324935f
Ticket: 218379ffffffffffffffffffffffffffffffffff
speeding up tclPkgUnknown
User & Date: nobody on 2000-10-26 00:56:53
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4355 RFE
    Version: 8.2.3
    SubmitDate: '2000-03-10'
    LastModified: '2000-08-15'
    Severity: LOW
    Status: Closed
    Submitter: techsupp
    ChangedBy: ericm
    OS: BSD
    OSVersion: FreeBSD-4.0 -current
    Machine: Dual PIII-450
    FixedDate: '2000-10-25'
    ClosedDate: '2000-08-15'
    
    
    Name:
    
    Mikhail Teterin
    
    
    Extensions:
    
    TclX, SQL
    
    
    ObservedBehavior:
    
    The implementation of tclPkgUnknown uses for(n) loop to go through the auto_path list.
    
    
    DesiredBehavior:
    
    Using the foreach(n) loop is much neater and speedier, although the speed difference is hardly noticeable.
    
    
    Patch:
    
    --- library/package.tclWed Apr 21 17:50:29 1999
    
    +++ library/package.tclThu Mar  9 22:41:39 2000
    
    @@ -438,3 +438,3 @@
    
         }
    
    -    for {set i [expr {[llength $auto_path] - 1}]} {$i >= 0} {incr i -1} {
    
    +    foreach d $auto_path {
    
     # we can't use glob in safe interps, so enclose the following
    
    @@ -442,4 +442,3 @@
    
     catch {
    
    -    foreach file [glob -nocomplain [file join [lindex $auto_path $i] \
    
    -    * pkgIndex.tcl]] {
    
    +    foreach file [glob -nocomplain [file join $d * pkgIndex.tcl]] {
    
     set dir [file dirname $file]
    
    @@ -452,3 +451,3 @@
    
     }
    
    -set dir [lindex $auto_path $i]
    
    +set dir $d
    
     set file [file join $dir pkgIndex.tcl]
    
    @@ -466,5 +465,4 @@
    
         tclMacPkgSearch $dir
    
    -    foreach x [glob -nocomplain [file join $dir *]] {
    
    -if {[file isdirectory $x]} {
    
    -    set dir $x
    
    +    foreach dir [glob -nocomplain [file join $dir *]] {
    
    +if {[file isdirectory $dir]} {
    
         tclMacPkgSearch $dir
    
    
    PatchFiles:
    
    library/package.tcl
    
    
    
    
    This changes the order in which auto_path is processed -- instead of last to first, it is read first to last.  The implications of that must be investigated.
    
    - eric
    
    -- 03/10/2000 ericm
    
    Because this changes the order of auto_path searches, I think this modification should not be made.  The benefit of searching auto_path last to first is that applications can append items and be guaranteed that their libraries will be found first, giving them an opportunity to override system defaults.
    
    As you noted, the speed gain is negligable, so it's not clear that there's even a siginificant benefit to be gained from applying this patch.  The cleaner code is nice, but at the cost of backwards incompatibility, it is probably not worth it.  Perhaps with the [listx reverse] command that ought to be in 8.4, we can clean the code and retain backwards compatibility.
    
       Eric Melski                            The Other Tcl Guy
       ericm at ajubasolutions.com            Ajuba Solutions
    
    -- 08/15/2000 ericm
    
    
    
  4. foundin changed to: "final: 8.2.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "56. LibTomMath"
  10. title changed to: "speeding up tclPkgUnknown"
  11. type changed to: "RFE"