Re: package command sloow



rene schrieb:
Hi,

the following pkgIndex.tcl file takes some seconds for the first
"package require ..." command.

package ifneeded pkgA 0.1 "
if {[catch {package require pkgB}]} {source [file join $dir
pkgb.tcl]}
source [file join $dir pkga.tcl]
package provide pkgA 0.1"

A simple "catch {package require pkgB}" or "source [file join $dir
pkgb.tcl]" is fast. Is there a better way to go?

Yes, if you can influence your Tcl installation. Don't put your packages
into /usr/lib/..., the standard package command scans all subdirs of
/usr/lib for pkgIndex.tcl files...
Tcl modules (for Tcl 8.5) reduce some of this time too.

Michael

.