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



Uwe Klein wrote:

Stephan Kuhagen wrote:
Alexandre Ferrieux wrote:


A simple way of removing all the "first time" overheads (interpreter
init, bytecode compilation) would be to do the comparison on a file ten
times larger (just cat it over and over again).


Good point. I made the file 100 times larger now, so they do not fit into
memory and no in-memory-processing has an advantage (which destroys my
first and fastest solution with reading the whole file and the using
regexpt to that large string). I used the fastest Tcl version mentioned
here until now (Uwe Klein: while and gets in a proc).

Just for the fun of it:
I changed the [gets $fd line] to [set line [read $fd 65536]].
the difference is negligible.

uwe

I am no expert but presumably, not matter what the language, the gets or
read ends up as an fgets C library call. Is it possible the differences are
due in part to the way each language sets up the channel e.g buffer size,
blocking, no chars read in fgets etc?

Ian
.