Skip to content
Tcl Source Code History Of Ticket 1764318fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1764318fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1764318fffffffffffffffffffffffffffffffff

  1. Ticket change [4abe023ed3] (rid 126579) by petasis on 2007-07-31 11:09:09:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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
      }
      
    4. foundin initialized to: "obsolete: 8.4.16"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "petasis"
    10. subsystem initialized to: "69. Other"
    11. title initialized to:
      Improve performance on tcl_startOfNextWord and friends...
      
    12. type initialized to: "Bug"
  2. Ticket change [f2fbd6816b] (rid 109651) by petasis on 2007-07-31 18:10:19:

    1. priority changed to: "3 Low"
    2. title changed to:
      Improve performance of tcl_startOfNextWord and friends...
      
  3. Ticket change [fede8b052f] (rid 108658) by dgp on 2007-08-01 11:39:42:

    1. assignee changed to: "dgp"
    2. priority changed to: "7 High"
    3. subsystem changed to: "38. Init - Library - Autoload"
  4. Ticket change [7bdb319bbf] (rid 96976) by dkf on 2007-08-01 22:21:36:

    1. assignee changed to: "dkf"
    2. closedate changed to: "2007-08-01T15:21:36"
    3. closer changed to: "dkf"
    4. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Reworked so that code is much more efficient (avoids repeated recompilation of regular expressions, uses -start, etc.) To illustrate, here's the committed version of tcl_startOfNextWord:
        proc tcl_startOfNextWord {str start} {
            variable ::tcl::WordBreakRE
            set result {-1 -1}
            regexp -indices -start $start $WordBreakRE(next) $str result
            return [lindex $result 1]
        }
      That's about as efficient as we're going to get. :-)
      
      Note that not all operations can take full advantage of the efficiency gains. Can't be helped.
      
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
    9. username: "dkf"