Skip to content
Tcl Source Code History Of Ticket 680169ffff
Login

History Of Ticket 680169ffff

Artifacts Associated With Ticket 680169ffff

  1. Ticket change [de508b7791] (rid 114820) by lvirden on 2003-02-04 13:29:30:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
       A feature I believe would be useful is a master
      package index cache that would be updated each time a
      package was installed into a subtree.
      
      If the cache were present, it would be, by default, the
      only place searched for a package's presence (though
      this could be overridden by an application if so desired).
      
      This would reduce the startup time of a tcl
      interpreter, which in a general case can be quite
      lengthy if a site has 50 or more extensions installed.
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "lvirden"
    9. subsystem initialized to: "39. Package Manager"
    10. title initialized to: "Tcl interpreter pkgIndex 'cache'"
    11. type initialized to: "RFE"
  2. Ticket change [b60149655f] (rid 125349) by dgp on 2003-03-05 00:27:07:

    1. icomment:
      
      
      File Added - 44022: indexCache.patch
      
      Logged In: YES 
      user_id=80530
      
      here is a first pass at a patch that
      implements a cache for package indexes.
      
      It's main method of maintaining
      agreement with what is installed
      is via a cache miss.  A miss triggers
      a rebuild of the cache.  So, at any
      time you can rebuild the caches by
      
          package require non-existent-package
      
      Until the scheme become more sohpisticated,
      users of it should do that each time a package
      is installed/uninstalled.  Revisions to improve on
      this are welcome.
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  3. Ticket change [646b4c1df6] (rid 92767) by dgp on 2003-03-05 00:30:41:

    1. icomment:
      
      
      File Added - 44025: indexCache.patch
      
      Logged In: YES 
      user_id=80530
      
      corrected patch
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Add attachment "indexCache.patch" [dd1c3c57b1] (rid 114602) by dgp on 2003-03-05 00:30:41.

  5. Ticket change [886a9ce974] (rid 131860) by dgp on 2003-03-05 00:30:42:

    1. icomment:
      
      
      File Deleted - 44022: 
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [f20f8e9946] (rid 109471) by jenglish on 2003-03-05 03:20:33:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      This approach looks overly complicated and error-prone to
      me.
      
      It's especially dangerous to automatically generate the
      central package index in [info library] in the [package
      unknown] handler -- this is something that should be left up
      to the system administrator to do by hand.
      
      It it necessary to parameterize the cache by [info
      hostname], [info nameofexecutable], and the value of
      $::auto_path? Why would the same program need a different
      cache on different hosts?  (Actually, I think it would be
      best if any Tcl program with the same [info library] could
      use the same package cache, but there are pkgIndex.tcl
      scripts which use (IMO overly-)clever heuristics to decide
      whether or not to register 'ifneeded' scripts, so checking
      [info nameofexecutable] might be appropriate).
      
      Instead of parameterizing the cache by the $::auto_path
      value, it might make more sense to keep per-directory
      caches; [package unknown] could check for a cache before
      scanning for pkgIndex.tcl files while processing
      $::auto_path.
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  7. Ticket change [eaa596c318] (rid 103409) by dgp on 2003-03-05 03:27:38:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      just to clarify one point: I do not
      propose that this patch be
      integrated into the official Tcl
      sources.  Instead, it should
      remain here as an aftermarket
      add-on that sysadmins can
      add (and tweak) *if* they find
      that startup times on their systems
      are a serious problem.
      
      Alternative approaches are welcome
      and could also be offered on the
      same terms.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  8. Ticket change [4227a59221] (rid 116315) by dgp on 2003-03-05 03:35:22:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      If the central cache is truly dangerous, then
      it's very simple to remove [info library] and
      make use of per-user caches only.
      
      Sadly, yes, all the per-* restictions are needed.
      The only way to get around that is to cache
      the index script themselves rather than the
      results of running them.  Too much depends
      on interpreter state to do otherwise.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  9. Ticket change [2abb766675] (rid 118626) by dgp on 2003-03-05 03:38:15:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      FWIW, the caches should probably
      also be per-[package unknown] so
      that caches of one unknown handler
      don't interrupt a different one.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [9b1246251c] (rid 111062) by nobody on 2003-07-11 12:20:38:

    1. icomment:
      Logged In: NO 
      
      Works *much* better now; my 5+ second delay before getting a
      prompt is now gont!
      
      Script started on Thu Jul 10 23:55:48 2003
      sh$ time tclsh
      exit
      % exit
      
      real    0m5.556s
      user    0m1.587s
      sys     0m1.318s
      
      sh$
      sh$ # After patch to init.tcl
      sh$
      
      sh$ time tclsh
      exit
      % exit
      
      real    0m6.073s
      user    0m0.757s
      sys     0m1.368s
      
      sh$ # The .tclPackageIndexCache was created
      sh$
      sh$ time tclsh
      exit
      % exit
      
      real    0m0.750s
      user    0m0.287s
      sys     0m1.124s
      sh$ exit
      Script done on Fri Jul 11 00:03:10 2003
      
      Dave Bodenstab <[email protected]>
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  11. Ticket change [83290a19ef] (rid 117346) by jenglish on 2003-10-22 04:06:03:

    1. icomment:
      
      
      File Added - 65010: tcl-pkgcache.patch
      
      Logged In: YES 
      user_id=68433
      
      Attached tcl-pkgcache.patch is an alternate approach (which
      I've been using for several months now locally).  I believe
      this is the minimum necessary and sufficient change to
      init.tcl:
      
      +    if {[info library] != ""} {
      +       variable pkgCache [file join [info library]
      pkgCache.tcl]
      +       if {[file exists $pkgCache]} { 
      +           source $pkgCache
      +       }
      +    }
      
      This just sources the file $tcl_library/pkgCache.tcl on
      startup, if it exists.  Generating and maintaining the
      package cache is left up to local administrative policies.
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  12. Add attachment "tcl-pkgcache.patch" [4b7ba57864] (rid 126719) by jenglish on 2003-10-22 04:06:03.

  13. Add attachment "mkcache.tcl" [e7f8d83d6b] (rid 104567) by jenglish on 2003-12-16 06:49:57.

  14. Ticket change [c9a9e3d3eb] (rid 122328) by jenglish on 2003-12-16 06:49:57:

    1. icomment:
      
      
      File Added - 70683: mkcache.tcl
      
      Logged In: YES 
      user_id=68433
      
      Attached mkcache.tcl is the script I've been using to
      rebuild the package cache.
      
      The script is very simple-minded: first it [package forget]s
      everything (to clear the cache); then it calls
      [tclPkgUnknown] to source all the pkgIndex.tcl files;  and
      finally it outputs the [package ifneeded] script for
      everything discovered in part 2.
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  15. Ticket change [fc45aad279] (rid 108207) by basilik99 on 2012-05-02 02:02:05:

    1. icomment:
      I attached an enhanced version of dgp's script. I run Tcl 8.5. on Windows. I put the code right after Windows implementation of auto_execok.
      
      1- Replaced "~" by "$env(APPDATA)" as I am on Windows.
      
      2- Replaced ugly foreaches (sorry dgp!) by "lassign" new command.
      
      Now for real changes:
      3- Fixed a problem which was probably not present for Tcl 8.4 (for which you initialy developped the patch right?) Parameter "version" sometimes gets sets to "0-", which is not accepted as a version in [package ifneeded]. So, when reading the cache, avoided the call to ifneeded when version was not found. Anyway, ifneeded cannot return different from "" in that case...
      
      4- The proposed solution worked for almost all packages, but not for Thread. Indeed, its pkgIndex.tcl contains:
      package ifneeded Thread 2.6.5 [list thread_load $dir]
      where "thread_load" is a proc declared in the pkgIndex.tcl. So caching only [package ifneeded] scripts was not enough. I had to cache the pkgIndex.tcl itself. I didn't copy the pkgIndex.tcl's content, but only its path. Then I sourced it while having set $dir. I needed a special trick at the end to effectively execute the script inside the [package ifneeded], not only the pkgIndex.tcl's content. For TM, I used the previous solution.
      I am seeking your comments about this change.
      
      With your initial patch, I got the following:
      % time {package require md5}
      115286 microseconds per iteration
      % time {package require tdom}
      125298 microseconds per iteration
      % time {package require Tclx}
      468442 microseconds per iteration
      
      With my new patch, it is similar, but a bit slower. But that's acceptable for me as the solution is generic:
      % time {package require md5}
      178442 microseconds per iteration
      % time {package require tdom}
      138962 microseconds per iteration
      % time {package require Tclx}
      497901 microseconds per iteration
      
      Previously, loading md5 took 5 seconds, tdom around 3 seconds, asme for Tclx!
      
      Now for questions:
      Q1- I do not understand the benefit of putting the cache on the Tcl installation directory (which is a network drive for me). Anyway the cache is per-machine. A cache in user's local directory would be enough I think. Moreoever, for a single machine, we reached a cache file of around 5000 lines. When 10 or 20 users will use that cache system, the file is gonna get huge! .. probably slow to [source]...
      
      
    2. login: "basilik99"
    3. mimetype: "text/plain"
    4. username: "basilik99"
  16. Ticket change [fdb0ecee33] (rid 108455) by basilik99 on 2012-05-02 02:13:13:

    1. icomment:
      Oops. Cannot attach file as I am not ticket owner... Could I send you an email dgp so that you attach it?
      
      
    2. login: "basilik99"
    3. mimetype: "text/plain"
    4. username: "basilik99"
  17. Ticket change [c6c990696d] (rid 121828) by dkf on 2012-05-02 20:37:07:

    1. icomment:
      SF's pretty restrictive about who can manipulate attachments (probably because of abuse). Open a patch ticket and just comment here with its artifact ID.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  18. Ticket change [3ef7291d4b] (rid 121368) by basilik99 on 2012-05-03 00:58:32:

    1. icomment:
      Please find attached script in new feature request ID 3523089 "Tcl interpreter pkgIndex 'cache' - new version".
      
      
    2. login: "basilik99"
    3. mimetype: "text/plain"
    4. username: "basilik99"