[PD-dev] Tcl_Eval() vs. Tcl_EvalObjEx()
Mathieu Bouchard
matju at artengine.ca
Thu Mar 6 15:13:32 CET 2008
On Thu, 6 Mar 2008, Mathieu Bouchard wrote:
> On Thu, 6 Mar 2008, Hans-Christoph Steiner wrote:
>> I am thinking of switching it to use Tcl_EvalObjEx(), which compiles
>> the Tcl to bytecode, then caches the bytecode. It also skips some
>> deprecated actions which Tcl_Eval() still does.
>> Anyone know anything about this? I am curious about what the
>> pitfalls might be before going down this road.
> Just try it, and see whether it works, and whether it's any faster. Should be
> easy to try, no?
> To make a Tcl string object, just use Tcl_NewStringObj(s,strlen(s)).
Now that I think of it, that code would get recompiled every time it runs,
which would make it slower as long as it doesn't contain loops, and as
long as the server sends slightly different commands each time. If you
want to run things faster, make procs for common code and pass anything
variable as arguments to those procs. this is the only way to save time on
this. But I'm really not sure that the speed gain is significant...
I know that Tcl keeps a cache of compiled non-procs for the [eval] and/or
[expr] command, but I don't recall the specifics, and obviously it doesn't
apply if you have a bunch of %d %s changing all of the time in your
strings.
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
More information about the Pd-dev
mailing list