Overview
| Artifact ID: | 5de72b5c095fafbf40d8d30904072c99a93df5f2 |
|---|---|
| Ticket: | 218556ffffffffffffffffffffffffffffffffff
Tcl8.1b1 regexp's are now 17 times slower than in Tcl8.0.4 |
| User & Date: | nobody on 2000-10-26 01:02:08 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 1063 Bug Version: 8.1b1 SubmitDate: '1999-01-15' LastModified: '1999-08-04' Severity: SER Status: Released Submitter: pat ChangedBy: stanton OS: Windows NT OSVersion: 4.0 Machine: X86 FixedDate: '1999-06-01' FixedInVersion: 8.1.1 ClosedDate: '2000-10-25' Name: vince darley Extensions: none CustomShell: none ReproducibleScript: proc scancontext {cmd args} { switch $cmd { "create" { uplevel 1 { set __scan 0 while {[array exists scancontext$__scan]} { incr __scan } set scancontext[set __scan]() 1 return scancontext$__scan } } "delete" { upvar [lindex $args 0] scan unset scan } } } proc scanmatch {scanid regexp script args} { if {[string match "-*" $scanid]} { set flags $scanid set scanid $regexp set regexp [list $flags $script] set script [lindex $args 0] } else { set regexp [list -- $regexp] } upvar $scanid scan set scan($regexp) $script return $scanid } proc scanfile {scanid fid} { upvar $scanid scan upvar matchInfo m set m(linenum) 0 set m(offset) 0 while {[set count [gets $fid m(line)]] >= 0} { incr m(linenum) incr m(offset) $count foreach reg [array names scan] { if {$reg == ""} {continue} if {[regexp [lindex $reg 0] [lindex $reg 1] $m(line) "" m(submatch0) m(submatch1) m(submatch2)]} { uplevel 1 $scan($reg) } } } } proc test {} { global tk_library set cid_scan [scancontext create] scanmatch $cid_scan "^\[ \t\]*(proc|while|if|blah)" { incr count 1 } scanmatch $cid_scan "^\[ \t\]*(foreach|namespace|global)" { incr count 1 } set count 0 foreach f [glob -nocomplain [file join $tk_library *.tcl]] { if {![catch {open $f} fid]} { scanfile $cid_scan $fid close $fid } } scancontext delete $cid_scan } time test 10 ObservedBehavior: Running this script under Tcl 8.0.4 takes 2.4 seconds per iteration. Under Tcl 8.1a2 it was about 7.5 times slower Under Tcl 8.1b1 it is SEVENTEEN (yes 17) times slower than Tcl 8.0.4, it takes more than 40 seconds per iteration. The script basically makes repeated use of simple regexp's like "^\[ \t\]*(proc|while|if|blah)" DesiredBehavior: I expect regexps using the new engine to be faster, not slower than tcl8. In particular, a slowdown of a factor of 17 is simply unacceptable. I will never be able to use Tcl 8.1 in many of my applications if this is not fixed. This is a known bug. This, rather extensive example, points out that a global regexp object needs to be cached and reused when compiling regular expressions. This will prevent the shimmering. 03/23/1999 18:00 - surles - A second level cache has been added that should fix this problem. 05/12/1999 18:38 - stanton - - foundin changed to: "obsolete: 8.1b1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "43. Regexp"
- title changed to:
Tcl8.1b1 regexp's are now 17 times slower than in Tcl8.0.4
- type changed to: "Bug"