Re: Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen <stk@xxxxxxxxxx>
- Date: Sun, 31 Dec 2006 13:32:12 +0100
Hello
If you want a speed boost, make sure that the channel is configured to
use -translation binary and use [read].
But [read] has the disadvantage that you can not read line by line, or do I
miss something here?
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?
---
proc grep {} {
set f [open bigfile r]
fconfigure $f -translation binary
while { [gets $f line] >= 0} {
if {[string match -nocase "*destroy*" $line]} {
puts $line
}
}
}
---
With the fconfigure the script runs 0.769s and when removing the fconfigure,
the script runs 0.703s...
That turns off a lot of
processing that would otherwise slow things down. Also, if your file is
only a few percent of your available physical address space in size,
then slurping it all into memory is best anyway. :-)
Yes, that was of course the solution I finally came up with, but this
doesn't work of course, when files get really big.
Regards
Stephan
.
- Follow-Ups:
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Donal K. Fellows
- 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: George Petasis
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Alexandre Ferrieux
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Uwe Klein
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Ian Bell
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Donal K. Fellows
- 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... [Idea?]
- 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
|