Re: Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen <stk@xxxxxxxxxx>
- Date: Sun, 31 Dec 2006 01:42:42 +0100
Earl Greida wrote:
"Stephan Kuhagen" <stk@xxxxxxxxxx> wrote in message
news:en5klt$7fa$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On my computer (Linux 2.6.18, 2.6 GHz Pentium 4)..
0.273s for Perl
The Python-Version was....0.622s.
Tcl...0.937s
To me, the question is how often does the program need to read the 8.2MB
file. If every second then the time difference matters. If once a minute
then the few hundred milli-second difference becomes less important. If
only a few times then the time difference is essentially irrelevant. The
question becomes, which language is easier to use, and produces a program
that is easier to read, easier to maintain, easier to enhance, and more
reliable, over the life of the program.
This is quite right. The Perl-Version (for me) is not as readable as the Tcl
or the Python version. But Pythons "for line in file" is really simple and
good looking. Additionally one doesn't build such a script to run this task
only once. For that you simply use a one-liner or grep and do not care if
it runs half a second or three seconds. So this is of course an academical
example. But if you really often do those tasks on really big files, then
this will make a difference. I had such an example, and luckily Tcl won,
because of its faster regexp compared to Python. But if the checks I had to
do on the data were more simple and could have been done without regexp but
with simple string matching, Python would have been some times faster. And
since this specific task runs about in a loop some hundred times every ten
minutes, the runtime of the script has some serious impact. For me, the
slowness of [gets] doesn't do any harm to my preference to Tcl. But I was
really wondering, why reading strings from a file is so slow compared to
the others, because I have the feeling, that for many tasks this is a very
central bottleneck.
Regards
Stephan
.
- Follow-Ups:
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: slebetman@xxxxxxxxx
- Re: Tcl faster than Perl/Python...but only with tricks...
- References:
- Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Earl Greida
- Tcl faster than Perl/Python...but only with tricks...
- Prev by Date: Re: Tcl faster than Perl/Python...but only with tricks...
- Next by Date: Re: Tcl faster than Perl/Python...but only with tricks...
- Previous by thread: Re: Tcl faster than Perl/Python...but only with tricks...
- Next by thread: Re: Tcl faster than Perl/Python...but only with tricks...
- Index(es):
Relevant Pages
|