You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7afdfdd
Browse filesBrowse the repository at this point in the historyBrowse files
perf(javascript): read a regexp repeating a capture group name in linear time
Validating a named capture group compares its branch against every branch
already recorded for that name, and acorn compares two branches by walking one
chain per node of the other — quadratic in the nesting depth, per pair. A
pattern of 160 alternatives each nesting a same-named group 160 deep took
7.4s where the same pattern with distinct names took 0.09s.
A branch chain holds at most one branch per disjunction, so marking each
disjunction the first chain passed answers the comparison in one walk of the
second. The same pattern now validates in 0.12s (acornjs/acorn#1445).
0 commit comments