Re: My own control structures are slow



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
.