Re: Tcl faster than Perl/Python...but only with tricks...



Mark Janssen wrote:

Are you sure gets and while are slow? At least a part of the result the
time command is giving is spent in intialization of the Tcl
interpreter. A better way to test the performance of the Tcl code would
be to use the [time] command to determine the time.

This would be the Tcl-way to test performance, of course. But since the
Perl/Python Versions also have to load the their interpreter, I think it
would be not fair to skip this step for Tcl. But to check that, I just
checked an empty Tcl-Script with the same Method (four runs, average of the
last three), which shows, that skipping the tclsh-loading saves only
0.015s.

I think, the biggest "mistake" I made was not to take the while/gets into a
proc, as mentioned by Uwe Klein and George Petasis. That improves
performance because of bytecode compilation.

Regards
Stephan

.



Relevant Pages

  • Re: invalid command name and Tcl_Main
    ... granularity of interaction, and of course experience in both ... C code would call the appropriate Tcl functions to initialize ... an interpreter, and then make calls to that interpreter with tcl code ...
    (comp.lang.tcl)
  • Re: Attaching to a Python Interpreter a la Tcl
    ... I had an tcl embedded into my ... > The coolest thing was however, I was able to attach to the interpreter ... > (built in to my app) via a tcl shell in which I could type in regular ... > tcl code which would be interpreted by the interpreter of my ...
    (comp.lang.python)
  • Tcl thread local storage memory problem
    ... I am working on an application that originally uses one thread, TCL ... and the C-library to initialize an interpreter and executing standard ... InitializeThreadLocalStorage(); /*If no threads, initialize ... able to get Tcl thread local storage ...
    (comp.lang.tcl)
  • Re: File data format
    ... This is how I always look at data processing with Tcl: ... then let the very effecient tcl interpreter do the parsing. ... Create procs that match the data keys. ... date, commit, and compile, that matched the same signature, then your ...
    (comp.lang.tcl)
  • Re: No argv, argc for worker thread
    ... I expected that a Tcl interpreter started in any manner would accept options ... This is how the interpreter works with command line options ... a "main" script processes command line ...
    (comp.lang.tcl)