Repository navigation
Commit da8102d
committed
fix(html): scan a run's gap instead of matching it
The pattern deciding whether a classic run may span what sits between two
tags backtracks exponentially: an alternation of whitespace and a lazily
closed comment, repeated. A page whose tags are separated by `<!--` and
enough `--><!--` hangs the build — measured at 1.08s for 26 of them, and
doubling every two.
The span is scanned instead, which reads each character once: 200k of the
same repetitions answer in 13ms.1 parent 022b5b9 commit da8102d
1 file changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
169 | 188 | | |
170 | 189 | | |
171 | 190 | | |
| |||
1511 | 1530 | | |
1512 | 1531 | | |
1513 | 1532 | | |
1514 | | - | |
1515 | | - | |
1516 | | - | |
| 1533 | + | |
1517 | 1534 | | |
1518 | 1535 | | |
1519 | 1536 | | |
| |||
0 commit comments