Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 431a23dd1f77703bbe55cf3ec620d79b3bd6cd78
Ticket: 218859ffffffffffffffffffffffffffffffffff
regexp/regsub operates veeery long on long strings sometimes
User & Date: nobody on 2000-10-26 01:06:47
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2440 Bug
    Version: 8.1.1
    SubmitDate: '1999-07-23'
    LastModified: '1999-08-04'
    Severity: MED
    Status: Released
    Submitter: techsupp
    ChangedBy: stanton
    RelatedBugIDs: 2447
    OS: Windows NT
    OSVersion: v4.0 SP5 (Also on Win 98)
    Machine: X86
    FixedDate: '1999-08-04'
    FixedInVersion: 8.2b3
    ClosedDate: '2000-10-25'
    
    
    Name:
    Ingemar Hansson
    
    ReproducibleScript:
    # I'm interested in extracting a file name at the end of a line
        # The file name may contain white spaces
        # Generate a string that looks like the one I use (764 chars long)
        set line {tcc -o x:\xxx\xxx.o }
        for {set i 0} {$i < 20} {incr i} {
            append line {-x:\xxx_xxxxxx\xxxxxx\xxx_xx_xxxxx }
        }
        append line {z:\zzz_zzzzzz\zzzzzz\zzz_zz_zzzzzzz\zzzzzz.c}
        
        # This commands takes long time
        regexp -- {(?:tcc|tasm) -o .*? (.:.*)} $line "" file
        
        # This one is pretty fast
        regexp -- {(?:tcc|tasm) (-o .*?) (.:.*)} $line "" "" file
        
        # This one is also pretty fast
        regexp -- {(tcc|tasm) -o .*? (.:.*)} $line "" "" file
        
        # This one is really fast
        regexp -- {(tcc|tasm) -o .*? (.:.*)} $line "" "" file
    
    ObservedBehavior:
    The problem seems to be using of non-capturing parenthesis in a regular
        expression. In the example above "long time" is abour 5 seconds on a 266
        MHz Pentium II. "Pretty fast" is about 20 milliseconds and "really fast"
        is 1 millisecond.
        In my real case the strings are about 1500 characters long, and then the
        "long time" is about 50 seconds and "really fast" is about 3
        milliseconds.
    
    DesiredBehavior:
    Obviously I want to see "really fast" times in for any regular
        expression.
    
    
    
    07/28/1999 14:46 - stanton - This is a major performance issue with regexp.  Henry Spencer is looking into the problem.
    
    08/04/1999 17:45 - stanton - Applied a patch submitted by Henry that significantly improves the performance of these types of expression.
    
    
    
  4. foundin changed to: "final: 8.1.1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "43. Regexp"
  10. title changed to:
    regexp/regsub operates veeery long on long strings sometimes
    
  11. type changed to: "Bug"