Re: Tcl faster than Perl/Python...but only with tricks...
- From: Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 13:18:01 +0100
Alexandre Ferrieux wrote:
Uwe Klein a écrit :He he:
Just for the fun of it:
I changed the [gets $fd line] to [set line [read $fd 65536]].
the difference is negligible.
Ha ! This one seems to point to my suggestion about some
post-processing done in the channel code (encoding or crlf). Can you
try with -translation binary, and also play around with various
-encoding values ?
Also, another interesting comparison point would be stdio's
fread()/fgets(). Not sure 'grep' uses it though (does anybody know
whether Perl and Python do ?). You may need to compile a 3-line C
program to test...
-Alex
(This is actually broken because the searchterm will not be found
if it spans a block boundary, )
#!/usr/bin/tclsh
proc matchdestroy {fd} {
while { [set line [read $fd 65536]] != "" } {
if {[string match -nocase "*destroy*" $line]} {
puts $line
}
}
}
set f [open bigfile r]
fconfigure $f -encoding binary -translation binary
matchdestroy $f
#end
real 0m0.207s
user 0m0.162s
sys 0m0.045s
the same applied to the initial procified [gets] example
runs for:
real 0m0.668s
user 0m0.654s
sys 0m0.014s
.
- Follow-Ups:
- Re: Tcl faster than Perl/Python...but only with tricks...
- From: Stephan Kuhagen
- 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: Alexandre Ferrieux
- Tcl faster than Perl/Python...but only with tricks...
- Prev by Date: Re: unicode normalization
- 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
|