Overview
| Artifact ID: | 715c3e174b869ca39c751abdedec2c5aa2d43968 |
|---|---|
| Ticket: | a4a7f2abd376b2806073d2865f07b7d910b04574
Tcl [string match] and [glob] are exponential complexity for bad patterns, could be linear |
| User & Date: | aspect on 2017-05-06 07:00:01 |
Changes
- icomment:
This deserves some commentary in the code: > You have (a) > > pnext = pattern - 1; > > snext = str; > where Russ has > > nextPx = px > > nextNx = nx + 1 pnext = pattern - 1 because the while loop immmediately after case '*' increments pattern to the character after the final *. snext I moved the increment to the backtrack point (matchFail) to save counting unichars and keep the check for end-of-string out of the main logic flow. I would really like to factor some of the repetition within the function (all the UCHAR bits), possibly move []-handling into a static function to keep the main loop clearer .. and if we could get rid of having almost identical code in ByteArrayMatch, UniCharMatch and UniCharCaseMatch that would be a big win imo. Thanks for the review/feedback!
- login: "aspect"
- mimetype: "text/plain"