Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a184888585667750f877bec771a01f017b1b2b3a
Ticket: 3519865fffffffffffffffffffffffffffffffff
[package require] is too slow
User & Date: twylite on 2012-04-25 20:30:33
Changes

  1. icomment:
    @dkf: You said "Let the cache be a dictionary, indexed by normalized filename with one entry per dir seen in $auto_path (or whatever path is used), stored in the user's home directory"
    
    I think a user-and-machine-specific cache is key, so this sounds to me like the right direction.  Using one file per auto_path dir is an interesting approach - I'll look at doing some performance profiling on it.
    
    Some comments:
    
    -  "Home directory" is fine on *nix, but needs to be local appdata path on Windows.  It is common on Active Directory domains for the home directory to be on a network share (in which case accessing the cache will be slow, and the cache will be visible to different machines).
    
    - The cache you suggest will avoid searching for and loading pkgIndex files, but will not address the [glob]s done within pkgIndex files or tcl::tm::unknownHandler, nor the [file exists] checks for tclIndex.
    
    I have been looking into caching [package ifneeded] calls, and overriding [package unknown] to be a nop (or empty the auto_path and module paths) if the cache is up to date.  It is an approach that will avoid all [glob] and [file exists] calls, as well as not loading pkgIndex files.  It would be trivial to extend this to cover tclIndex files as well.  Using your auto_path and [file mtime] ideas one could improve the efficiency with which such a cache could be rebuilt.
    
    Do you see any problems with this approach?
    
    
    
  2. login: "twylite"
  3. mimetype: "text/plain"
  4. username: "twylite"