Overview
| Artifact ID: | 67c67fa4cb17b1f3b24b432eb925e024b0b974e0 |
|---|---|
| Ticket: | a4a7f2abd376b2806073d2865f07b7d910b04574
Tcl [string match] and [glob] are exponential complexity for bad patterns, could be linear |
| User & Date: | aku on 2017-05-06 03:36:22 |
Changes
- icomment:
Questions from reading the changes (the switches(sic) between if/switch/if/switch made it a bit hard (*)). You have (a) > pnext = pattern - 1; > snext = str; where Russ has > nextPx = px > nextNx = nx + 1 So, you are storing -1 relative to what he does. Later, where the next-values are used to restart I see partial compensation for this -1, i.e. (b) > pattern = pnext; > str = snext + TclUtfToUniChar(str, &sch); str compensates, pattern does not seem to. For completeness of comparison, Russ' equivalent code is > px = nextPx > nx = nextNx Can you explain ? Also, would getting rid of both the -1 in (a) and the compensation i (b) still work ? If yes I would consider that simpler, especially as we would loose the (semi-expensive) TclUtfToUniChar needed in (b) (*) In the end I used fossil's web diff where you can click on the (*)-marks of two revisions to get a diff between them, to see only one change if/switch.
- login: "aku"
- mimetype: "text/plain"