Overview
| Artifact ID: | 4abe023ed3f8fd7072ef7e5e11638ac782b5e1f2 |
|---|---|
| Ticket: | 1764318fffffffffffffffffffffffffffffffff
Improve performance of tcl_startOfNextWord and friends... |
| User & Date: | petasis on 2007-07-31 11:09:09 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
Hi all, I have recently noticed that the file word.tcl in the tcl library has not been updated to use the (relatively) new -start option of regexp. Changing the file word.tcl to remove [string range ...] call and use the -start regexp option, all the procs were made much faster, especially for large strings. As an example, the body of tcl_startOfNextWord: proc tcl_startOfNextWord {str start} { global tcl_nonwordchars tcl_wordchars if {[regexp -indices "$tcl_wordchars*$tcl_nonwordchars+$tcl_wordchars" \ [string range $str $start end] result]} { return [expr {[lindex $result 1] + $start}] } return -1 } Can be changed to: proc tcl_startOfNextWord {str start} { global tcl_nonwordchars tcl_wordchars if {[regexp -indices -start $start -- \ "$tcl_wordchars*$tcl_nonwordchars+$tcl_wordchars" \ $str result]} { return [lindex $result 1] } return -1 } - foundin changed to: "obsolete: 8.4.16"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "petasis"
- subsystem changed to: "69. Other"
- title changed to:
Improve performance on tcl_startOfNextWord and friends...
- type changed to: "Bug"