Skip to content
Tcl Source Code History Of Ticket 1452969
Login

History Of Ticket 1452969

Artifacts Associated With Ticket 1452969

  1. Ticket change [d9ad278d34] (rid 107645) by bstellar on 2006-03-18 04:51:54:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Hi I am having considerable performance issue, from 
      v8.0 to v8.3 on regexp for the following statement in 
      my program.
      
      I have atttached the program, which responses in same 
      time for 8.0 version as below:
      Before if - The time is Fri Mar 17 9:17:12 PM US 
      Mountain Standard Time 2006
      Inside the if The time is Fri Mar 17 9:17:12 PM US 
      Mountain Standard Time 2006
      lsWzrdEcnRequestedByCompleteList_choices
      
      and 20 seconds for 8.3:
      Before if - The time is Fri Mar 17 9:18:53 PM US 
      Mountain Standard Time 2006
      Inside the if The time is Fri Mar 17 9:19:22 PM US 
      Mountain Standard Time 2006
      lsWzrdEcnRequestedByCompleteList_choices
      
      Please help me, if it is known issue.
      
      Thanks,
      Balaji
      
    4. foundin initialized to: "final: 8.3.5"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "bstellar"
    9. subsystem initialized to: "18. Commands M-Z"
    10. title initialized to: "regexp 20sec delay from 8.0 to 8.3"
    11. type initialized to: "Bug"
  2. Add attachment "jdReproduceIssue.tcl" [79f47d3ed1] (rid 90220) by bstellar on 2006-03-18 11:51:54.

  3. Ticket change [0b470586b9] (rid 113955) by bstellar on 2006-03-18 11:51:55:

    1. icomment:
      
      
      File Added - 171362: jdReproduceIssue.tcl
      
      
      
    2. login: "bstellar"
    3. mimetype: "text/plain"
    4. username: "bstellar"
  4. Ticket change [5eea19ceae] (rid 115718) by bstellar on 2006-03-18 11:53:09:

    1. priority changed to: "7 High"
  5. Ticket change [f522dc92a2] (rid 130057) by bstellar on 2006-03-18 11:55:15:

    1. icomment:
      Logged In: YES 
      user_id=1479322
      
      This regexp creates delay, please help;
      if { [ regexp {^(.*)=(.*)$} $sEnvPair sDummy 
      sEnvName sEnvValue ] == 1 } {
      
      
      
    2. login: "bstellar"
    3. mimetype: "text/plain"
    4. username: "bstellar"
  6. Ticket change [7a7abcc976] (rid 90326) by bstellar on 2006-03-18 12:04:13:

    1. priority changed to: "9 Immediate"
  7. Ticket change [02b23e0e8c] (rid 119688) by mistachkin on 2006-03-18 13:13:51:

    1. subsystem changed to: "43. Regexp"
  8. Ticket change [df36715a00] (rid 114978) by msofer on 2006-03-18 20:35:13:

    1. foundin changed to: "obsolete: 8.4.13"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      The performance confirmed bad on modern Tcl (8.3 is already
      quite old, if you are migrating you should use 8.4).
      
      Since 8.0 the regexp engine has been completely replaced;
      the new unicode awareness does make it slower.
      
      However, for your particular case, the use of regexp is
      probably not necessary: a combination of [string last] and
      [string range] is much more efficient. Look:
      
      % time {
          if {[set n [string first = $sEnvPair]] != -1} {
              set sEnvName [string range $sEnvPair 0 [expr {$n-1}]]
              set sEnvValue [string range $sEnvPair [incr n] end]
          }
      } 1000
      168.87 microseconds per iteration
      % time {
          if {[regexp {^(.*)=(.*)$} $sEnvPair sDummy sEnvName
      sEnvValue] == 1} {
          }
      }
      22609833 microseconds per iteration
      
      BTW: priority 9 is for release-blocking bugs; this is
      nowhere near qualifying.
      
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. priority changed to: "5 Medium"
    6. title changed to: "performance: regexp 20sec delay from 8.0 to 8.3"
    7. username: "msofer"
  9. Ticket change [32b72cbcb7] (rid 93663) by msofer on 2006-03-18 20:50:30:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      Oops: [string last], not [string first]. Still much faster:
      % time {
          if {[set n [string last = $sEnvPair]] != -1} {
              set sEnvName [string range $sEnvPair 0 [expr {$n-1}]]
              set sEnvValue [string range $sEnvPair [incr n] end]
          }
      } 1000
      1040.019 microseconds per iteration
      
      Just by looking at your snippet of code, I'm guessing that
      you want [string first], and that your regexp is wrong as it
      will produce the wrong results if anybody has an '=' in his
      name. 
      
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  10. Ticket change [bb711a769e] (rid 129481) by bstellar on 2006-03-19 02:33:20:

    1. icomment:
      Logged In: YES 
      user_id=1479322
      
      Excellent, this help me very much...
      
      
    2. login: "bstellar"
    3. mimetype: "text/plain"
    4. username: "bstellar"
  11. Ticket change [1187f5ebd6] (rid 95161) by bstellar on 2006-03-19 02:38:17:

    1. closedate changed to: "2006-03-18T19:38:17"
    2. closer changed to: "bstellar"
    3. resolution changed to: "Fixed"
    4. status changed to: "Closed"
  12. Ticket change [a325727ebb] (rid 110006) by msofer on 2006-03-19 02:51:35:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      bstellar's problem is solved, but the performance bug is
      still there ...
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. resolution changed to: "None"
    5. status changed to: "Open"
    6. username: "msofer"
  13. Ticket change [df42f6034d] (rid 114986) by hobbs on 2006-03-20 03:14:37:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      The capturing appears to be the real killer.  Remove that
      the slowdown is small.  The match is still accurate, so I
      don't know what extra bits the RE is doing when capturing.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  14. Ticket change [74f623a3a5] (rid 105307) by dkf on 2006-03-20 06:04:31:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=79902
      
      The RE engine is pretty close to a black box to me; I know
      how to fix a very small subset of the problems it has, and
      this is definitely not one of them!
      
      Possible consideration: special-case in the outer [regexp]
      code to detect and handle the case where we have:
        ^(.*)<SOME_LITERAL>(.*)$
      as that's replacable by a simple substring search instead of
      the much more complex backtracking stuff that the RE engine
      does. But I've no time to implement this anyway.
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. username: "dkf"
  15. Ticket change [e3fde77244] (rid 87885) by nobody on 2006-03-20 16:21:38:

    1. icomment:
      Logged In: NO 
      
      Another solution is just to use the ? non greedy quamtifier:
      
      regexp {^(.*?)=(.*)$} ...
      
      Nice and quick. Also probably what the user intended (in 
      the case where there is a second '=').
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  16. Ticket change [ebc47366be] (rid 103587) by hobbs on 2007-12-04 09:08:11:

    1. icomment:
      Logged In: YES 
      user_id=72656
      Originator: NO
      
      I just found that this actually was introduced in the 8.3 timeframe, and wasn't an issue in 8.2:
      
      000 VERSIONS:                  1:8.5b3 2:8.4.17  3:8.3.5  4:8.2.3  5:8.0.5
      025 RE extract ini file       76083.10 75661.17 75340.00   152.00   312.00
      026 RE extract ini file ng      275.60   301.23   277.00   159.00     -=-
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  17. Ticket change [a911088c3b] (rid 99093) by hobbs on 2007-12-04 09:17:38:

    1. icomment:
      Logged In: YES 
      user_id=72656
      Originator: NO
      
      Oops, never mind the last - it is the RE only, I was actually basing it on the existence of regexp -all, which wasn't intro'd until 8.3, but the RE is bad for 8.2 as well.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"