Re: My own control structures are slow
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: My own control structures are slow

From: Christian Gollwitzer <auriocus@btcips73x1.cip.uni-bayreuth.de>
Date: Fri Sep 30 2005 - 11:01:20 CEST

Donald Arseneau wrote:
> OK, see if this runs faster:
>
> proc MAP4 command {
> set MAP_up [list upvar]
> foreach locvar [uplevel 1 {info locals}] {
> lappend MAP_up $locvar $locvar
> }
> proc mapbody {} "$MAP_up
> for {set y 0} {\$y<512} {incr y} {
> for {set x 0} {\$x<512} {incr x} {$command}
> }"
> uplevel 1 mapbody
> }

Many thanks for your suggestion, but it doesn't work either :-( because
"info locals" returns the empty string. If I do the upvar by hand, it
would run in 90 milliseconds. If I do

set sum 20
info locals

I get an empty response. Maybe this is a bug in my tcl 8.4.9? info
locals sems to work only inside a proc like

proc test {} {
   set sum 7
  info locals
}

which gives me "sum" :-( The cmdline in tkcon is executed with
"uplevel #0"
Any ideas?

        Christian
Received on Sat Oct 15 03:53:48 2005