From: Jeff H. <je...@ac...> - 2006-08-08 21:45:45
|
Andreas Kupries wrote: > Is the change below something the Tcl RE bytecompiler does=20 > automagically ? Could it be done ? >=20 > https://sourceforge.net/tracker/?func=3Ddetail&atid=3D112883&aid=3D153689= 0&group_id=3D 12883 >=20 > 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). There are a lot of cases where 'string' methods trump REs for speed. = This is not a case that the bytecompiler tries to outsmart the user - it doesn't = do that for any capturing REs. It would be nice if the RE handled this = better. I'm fairly certain that someone with strong determination and strong = will (to not go crazy ;) ) would find that the RE code is not efficient for many = simple cases. Unfortunately I don't have the time for this review. :( Jeff > replace: >=20 > if {![regexp -- (.*)=3D(.*) $x dummy varname val]} { > set varname anonymous > set val $x > } >=20 > with: >=20 > set idx [string last "=3D" $x] > if {$idx=3D=3D-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] > } |