Overview
| Artifact ID: | 28168e79112018d14585c32459dc8f33c8a619c9 |
|---|---|
| Ticket: | 219228ffffffffffffffffffffffffffffffffff
improve speed of read command |
| User & Date: | dkf on 2000-11-10 21:22:49 |
Changes
- icomment:
Do you get improved performance by specifying that you are reading binary data as opposed to data which needs converting to UTF-8/UNICODE? If that "fixes" the problem, then the problem is due to Tcl's encoding support, which can have quite a large performance penalty. In that case, there's not a lot that can be done about it. You would expect Perl to suffer similarly if it was trying to do encoding stuff though! A short test later, I find when reading binary data that I get much better performance with... proc process {file} { set fp [open $file r] fconfigure $fp -translation binary set i 0 set time [clock seconds] while {[string length [read $fp 42]] != 0} { if {!([incr i] % 50000)} { set now [clock seconds] puts "[expr {$now - $time}] secs, $i recs" set time $now } } close $fp } Unfortunately, the actual figures aren't too good since my computer started swapping... :^( - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"