From: SourceForge.net <no...@so...> - 2003-10-22 05:57:47
|
Feature Requests item #680169, was opened at 2003-02-04 05:29 Message generated for change (Comment added) made by jenglish You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=680169&group_id=10894 Category: 38. Package Manager Group: None Status: Open Resolution: None Priority: 5 Submitted By: Larry W. Virden (lvirden) Assigned to: Don Porter (dgp) Summary: Tcl interpreter pkgIndex 'cache' Initial Comment: 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. ---------------------------------------------------------------------- >Comment By: Joe English (jenglish) Date: 2003-10-21 14:06 Message: 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. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-07-10 22:20 Message: 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 <im...@mi...> ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-03-04 12:38 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-03-04 12:35 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-03-04 12:27 Message: 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. ---------------------------------------------------------------------- Comment By: Joe English (jenglish) Date: 2003-03-04 12:20 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-03-04 09:30 Message: Logged In: YES user_id=80530 corrected patch ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-03-04 09:27 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=360894&aid=680169&group_id=10894 |