From: SourceForge.net <no...@so...> - 2007-07-31 11:10:16
|
Bugs item #1764318, was opened at 2007-07-31 14:09 Message generated for change (Settings changed) made by petasis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1764318&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 69. Other Group: development: 8.4.16 Status: Open Resolution: None >Priority: 3 Private: No Submitted By: Georgios Petasis (petasis) Assigned to: Nobody/Anonymous (nobody) >Summary: Improve performance of tcl_startOfNextWord and friends... Initial Comment: 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 } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1764318&group_id=10894 |