Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2ee5522a229c3ec2a1218803607686393588883a
Ticket: 3519865fffffffffffffffffffffffffffffffff
[package require] is too slow
User & Date: twylite on 2012-04-20 23:48:07
Changes

  1. icomment:
    Scripts are loaded into an interp, and an interp is never shared across threads.  This means that execution within an interp is effective single-threaded, and (as you  surmised) a child thread/interp cannot load a package for another interp.
    
    If your interp is not busy then you can load packages "in the background" using [after idle], but this won't help you if the interp is running flat-out and never enters the event loop.
    
    You could load packages into an interp in a separate thread, and use thread::send to call commands in those packages, depending on your application's requirements.
    
    With regards to the slow package loading, I have also noticed and been investigating this problem.  A significant contributing factor is the use of [glob] within the package/module discovery logic.  Anti-virus applications can also dramatically reduce the performance of package loading.
    
    
  2. login: "twylite"
  3. mimetype: "text/plain"
  4. username: "twylite"