Mike - good advice - we use upvar all the time. upvar is your friend. :)
The problems we had were with the built-ins [string fn. It would be
cool to have an [ns_string library that did everything by reference,
or a -ref flag to [string. This may not be so much an issue with the
newer TCL releases - dunno.
Jim
>
> Jim Wilcoxson wrote:
> >
>
> >
> > The way I approach these things is to do a prototype in TCL using
> > existing interfaces/functions, develop the whole application/page that
> > will use it, and THEN if there is a performance problem, make sure
> > that this thingy is the cause. Most of the time the bottleneck is
> > not in something as low-level as reading the post data, but in loops,
> > searching, DB queries, etc.
> >
> > Where we have found very HUGE bottlenecks are in using TCL string
> > functions on large strings. TCL passes everything by value, so you
> > end up copying this huge string (like 300K) every time it is
> > referenced. A real performance killer.
>
>
> sometimes judicious use of 'upvar' to do passing-by-reference
> in tcl procs (instead of returning things in a return value)
> can help in this regard. people find upvar distasteful for some reason
> but it is useful sometimes to avoid some of the mega-string copies
> that can occur as you mentioned above..
>