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



Stephan Kuhagen wrote:
But [read] has the disadvantage that you can not read line by line, or do I
miss something here?

You have to write your code differently so that you can process multiple
lines at once, and then process the file in chunks (e.g. 1MB at a time).
The code to do this is a bit trickier, but it can be a big win if the
search term is expected to be uncommon.

And I just tried to set translation to binary, and it slowed things down. Am
I doing this wrong or is there something strange happening?

You're using [gets] with a binary channel, which isn't recommended at all.

Yes, that was of course the solution I finally came up with, but this
doesn't work of course, when files get really big.

If the file is really big, you'll find that the disk's seek times
dominate, whatever language you use.

Donal.
.