Commit 8b528fa
authored
fix: add anchoredFirstBytes check to state-reusing BoundedBacktracker (#111)
findIndicesBoundedBacktrackerAtWithState was missing the O(1) early
rejection check that exists in findIndicesBoundedBacktracker.
For pattern ^/.*[\w-]+\.php on 6MB input not starting with '/':
- Before: 377ms (full PikeVM scan)
- After: 40µs (O(1) rejection)
9000x improvement for non-matching anchored patterns.
Fixes #1071 parent f0f527d commit 8b528fa
2 files changed
+20
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
18 | 29 | | |
19 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
915 | 915 | | |
916 | 916 | | |
917 | 917 | | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
918 | 927 | | |
919 | 928 | | |
920 | 929 | | |
| |||
0 commit comments