Tk Library Source Code

View Ticket
Login
Ticket UUID: 1536890
Title: regexp usage is inefficient and can hang
Type: Bug Version: None
Submitter: yahalom Created on: 2006-08-08 18:15:54
Subsystem: ncgi Assigned To: welch
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-08-09 22:28:40
Resolution: Duplicate Closed By: mic42
    Closed on: 2006-08-09 06:56:37
Description:
using regexp in ::ncgi::nvlist is slower that the 
usage of string methods (although it looks better).
regexp also causes problems with bigger data which can 
cause ncgi to get stuck (try running it on big post 
data).
replace:

if {![regexp -- (.*)=(.*) $x dummy varname val]} {
          set varname anonymous
          set val $x
      }


with: 
set idx [string last "=" $x]
if {$idx==-1} {
   set varname anonymous
  set val $x
} else {
    set varname [string range $x 0 [expr {$idx-1}]]
    set val [string range $x [expr {$idx+1}] end]
}
User Comments: andreas_kupries added on 2006-08-09 22:28:40:
Logged In: YES 
user_id=75003

I checked as well and can confirm Michael's findings. The
unreleased code we have in the CVS really is without RE's in
nvlist.

mic42 added on 2006-08-09 13:56:37:
Logged In: YES 
user_id=302287

The bug was closed in July 2006, so the fix is only inside
CVS currently, not in a released version. CVS HEAD is not
equivalent to the latest released version...

Take a look at ncgi.tcl in CVS and the nvlist proc, it does
not contain a regexp anymore.... 

So this is really closed.

yahalom added on 2006-08-09 12:34:51:
Logged In: YES 
user_id=130120

I got very troubled from the response. the pervious bug 
mentioned was fixed in the days of the tcllib1.3 we are now 
in tcllib1.8 and the bug is still there!!!! this means that 
the bug fix is not in the head version and therfore is 
still open

mic42 added on 2006-08-09 02:11:18:
Logged In: YES 
user_id=302287

This is a duplicate of Bug # 532774, which is fixed in CVS head.