[tcltk-perl] Re: [Activetcl] why simple Tcl script have very different execution time...
Brought to you by:
hobbs
From: Visnet <vi...@tw...> - 2004-10-19 03:29:21
|
I noticed this as well. What I came to recognize is that when executing a script, you must wait for the scripting engine to load, then compile, then execute your script. When you are already inside an interpreter allot of that time is cut down. With larger applications, or issues that take a significant length of time. This becomes transparent. My workaround is rather simple. I create a procedure inside all of my applications that sources another script. In this way I can simply source other scripts and they behave in a much faster manner. You may wish to try writing a script that launches and loads all of the required extensions, then sources your application files. You will notice a speed increase even on your one liner. Konovalov, Vadim wrote: >why simple Tcl script have very different execution time when invoked from >file and from tclsh? > >Give following simple script: > >for {set i 0} {$i < 1000000} {incr i} {} > >If invoked from file: > tclsh a.tcl > >finishes execution in about 6 seconds on my PC. > >When I input same string from within "tclsh" shell it finishes in 3 seconds. > >Same behaviour (but larger execution time) when I replace 1000000 with >10000000 --- 60 and 25 seconds appropriately > >How this could be explained? Better yet, how can I speed up worse case to be >in line with best one? > >I used ActiveTCL version 8.4.6 > >Thanks in advance. > >Vadim. >_______________________________________________ >ActiveTcl mailing list >Act...@li... >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > |