Skip to content

fix: bound backtracking in test() and exec() for globs whose regex backtracks - #278

Open
aoikisan wants to merge 8 commits into
micromatch:masterfrom
aoikisan:linear-time-regexp
Open

aoikisan wants to merge 8 commits into
micromatch:masterfrom
aoikisan:linear-time-regexp

Conversation

@aoikisan

@aoikisan aoikisan commented Nov 23, 2026 •

Copy link
Copy Markdown

Some globs compile to a regex that takes exponential or polynomial time on an input that almost matches (CWE-1333). This gives those regexes a test() and exec() that use a DFA, so the time grows with the length of the input, subject to the limits below. The parser and the regex source are unchanged, and the existing tests show no change in what a glob matches. It makes no security claim.

It is a different approach from the open PRs that rewrite particular extglob shapes (#264 to #277), so it is offered as an alternative to weigh, not a replacement for any of them.

What it does

toRegex is the one place a source becomes a RegExp. It now classifies the backtracking of each regex it builds, once:

  • Cannot backtrack badly (most globs: *.js, **/*.js, src/**/*.{ts,tsx}): the plain RegExp is returned, exactly as before.
  • Polynomial (*a*, **/node_modules/**): the regex gets its own test() and exec(). The regex itself runs on inputs short enough to bound its work; longer ones go to a DFA built from the same source.
  • Exponential (+(*a), +(a|*a)): the same two methods. The DFA decides every test(), and every exec() except on a name the regex can read in few ways, which is described below.

A regex with no loop of either kind can still read one prefix in very many ways when optional parts follow each other: ?(a) repeated 55 times has about 2 to the 52nd readings of a x 27. So the readings of a prefix are counted for the first class, and a regex with more than 16 is treated like the exponential ones. Ordinary globs have at most 7.

The body of a lookahead is classified as a regex of its own and its work added, so !(+(*a)) is treated as exponential. Most negated globs stay linear: !(*.test).js and **/!(a|b)/*.js get the plain RegExp.

With the contains option a regex has no ^ and is tried from every start, so it is classified as a search: *a is linear as a whole match and quadratic there. On a near miss of 40,000 letters *a takes 336 ms on master and 1.3 ms here, and a call on a short name costs 0.97 to 1.09 times master on Node 24 and 1.07 to 1.56 on Node 12. A glob with no loop to fail in, such as a/b, stays a plain RegExp.

The DFA is built only as far as inputs take it, and cannot backtrack. When it says no, the regex never runs. When it says yes, exec() needs the capture groups, and the regex can take exponential time to come to them: in @(+(*a)c|*b) the first branch fails in every way it can before the second is tried. So past the limit the groups come from a matcher that tries things in the order the engine does and marks each place that failed, so no step is taken twice.

That matcher is slow on the short names most callers have, so exec() first counts the ways the regex can read this very name, one table read per character once the table is warm, and lets the regex answer where the work they allow is under 16,000 steps. Of 645,120 pairs of a glob and a name made to backtrack, 429,991 were let through, and no call on one took more than 17 us.

The returned object keeps the source, flags and prototype of new RegExp(source, flags).

Classifying is itself capped. A regex too large to classify within a fixed amount of work is treated as one that can backtrack, and the DFA decides every input.

Each DFA has a table of its own, which goes away with the regex, and the table holds at most 4,000 states. When an input reaches one more, the table is emptied and started again from the start state and the state just reached. So the memory of one regex is bounded whatever the names are, and reaching the limit costs time, not the bound.

The code is in lib/bounded, about 2,100 lines, with no dependencies. lib/picomatch.js changes by three lines.

Measurements

Each glob's regex on prefix + pump.repeat(k) + '/', in a child process with a 2 s deadline, on Node 24.19.0. The script is at the end.

Glob Input master this PR, at k = 16384
+(*a) aa + aa x k 7.5 ms at k=8, over 2 s at k=16 1.2 ms
*(*a) a + aa x k 4.3 ms at k=8, over 2 s at k=16 1.3 ms
+(*) a + a x k 13.0 ms at k=16, over 2 s at k=32 1.2 ms
+(a*) aa + aa x k 5.0 ms at k=8, over 2 s at k=16 1.3 ms
+(@(*a)) aa + aa x k 11.1 ms at k=8, over 2 s at k=16 1.4 ms
+(a|*a) aa + aaa x k 24.3 ms at k=4, over 2 s at k=8 1.4 ms
+(a*|b) aa + aa x k 5.4 ms at k=8, over 2 s at k=16 1.3 ms
+(*a|b) aa + aa x k 8.2 ms at k=8, over 2 s at k=16 1.3 ms
+(!(a)) a + a x k 14.4 ms at k=16, over 2 s at k=32 2.6 ms
*(!(f)) a + a x k 4.8 ms at k=16, over 2 s at k=32 1.2 ms
@(*a)+ aa + aa x k 11.4 ms at k=8, over 2 s at k=16 1.2 ms
(*a)+ aa + aa x k 11.7 ms at k=8, over 2 s at k=16 1.2 ms
{*a,b}+ aa + aa x k 11.7 ms at k=8, over 2 s at k=16 1.5 ms
*a*a*a*a*b a + aaaaaaaa x k 45.5 ms at k=8, 1.36 s at k=16 1.7 ms
**/+(*.)+(spec|test).+(ts|js)?(x) .a + .a x k 0.8 ms at k=16, over 2 s at k=32 1.4 ms
src/**/*(*.)@(spec|test).[jt]s?(x) src/ + .a x k 0.4 ms at k=16, over 2 s at k=32 1.7 ms

The times in the last column are each a first call in a fresh process, with the DFA states built during the call. The last two globs are the Jest testMatch in the nrwl/nx and microsoft/fluentui presets and the one Nx generates.

Lookaheads, and names that match

The same machine and deadlines of 20 s. The slow part of the first two globs is in a lookahead; the third matches, after a branch that fails. These globs are made up.

Glob Name Call master this PR
!(+(*a)) a x 20 + // test 31 ms 1.2 ms
!(+(*a)) a x 40 + // test over 20 s 1.1 ms
!(+(*a)) a x 16384 + b isMatch over 20 s 16.2 ms
!(+(a|*a)) a x 20 + b isMatch 8.9 s 3.0 ms
!(+(a|*a)) a x 16384 + b isMatch over 20 s 15.9 ms
@(+(*a)c|*b) a x 20 + b isMatch 32 ms 2.7 ms
@(+(*a)c|*b) a x 30 + b isMatch over 20 s 2.7 ms
@(+(*a)c|*b) a x 100000 + b exec over 20 s 37 ms
@(+(*a)c|*b) a x 1000000 + b exec over 20 s 314 ms

Slow parts that a separator keeps apart

Single calls of test. Until this PR's last commit the first and third were called quadratic and took the regex as long here as on master.

Glob Name master this PR
*a*a/*a*a/*a*a a x 331 three times, joined by /, then ! 36.0 s 1.4 ms
*a*a/*a*a a x 498 twice, joined by /, then ! 353 ms 0.5 ms
*(a)*(a)c*(b)*(b)c*(a)*(a) a, b and a x 331, joined by c, then ! 36.2 s 0.3 ms

A long chain of stars

*a repeated 100 times, tested on a repeated n times followed by //, each in a child process with a 20 s deadline. This glob is made up to show the mechanism; it is not from a project.

n master this PR
100 2.8 ms 4.8 ms
102 1,367 ms 6.9 ms
104 over 20 s 10.0 ms
500 over 20 s 4.5 ms
20000 over 20 s 5.9 ms
// node star-chain.js <path to picomatch>
const { spawnSync } = require('child_process');
const child = "const re=require(process.argv[1]).makeRe('*a'.repeat(100));const s='a'.repeat(Number(process.argv[2]))+'//';" +
  "const t=process.hrtime.bigint();const r=re.test(s);console.log(r+' '+(Number(process.hrtime.bigint()-t)/1e6).toFixed(1)+' ms')";
for (const n of [100, 102, 104, 500, 20000]) {
  const r = spawnSync(process.execPath, ['-e', child, process.argv[2], String(n)], { timeout: 20000, encoding: 'utf8' });
  console.log(`n=${n}: ${r.error ? 'over 20 s' : r.stdout.trim()}`);
}

Cost

Measured against master, in one process with the two taken in turn:

Node 24.19.0 Node 12.22.12
Per call, *.js, **/*.js, src/**/*.{ts,tsx} 1.01 to 1.03 times 1.00 to 1.02 times
Per call, **/!(*.test|*.spec).{js,ts} (polynomial) 1.08 to 1.10 times 1.41 to 1.60 times
Per call, **/node_modules/** (polynomial) 1.12 times 1.83 to 2.04 times
Per call, **/+(*.)+(spec|test).+(ts|js)?(x) (exponential), three short names 2.8 times 3.4 times
The same glob, 40 names of about 55 characters that match 3.7 times, 0.35 us against 0.10 5.1 times, 0.44 us against 0.09
The same glob, the first 200 different names in a new process 2.7 us against 1.0 each 7.1 us against 0.6 each
Per call, +(*a) on aaa, @(+(*a)c|*b) on ab, {*a,b}+ on banana (exponential) 1.6 to 1.8 times 2.2 to 2.5 times
Per call, !(+(*a)) and +(!(a)) on some-name.js (exponential, left to the matcher) 43 and 37 times, 3.1 and 3.5 us 61 and 54 times, 3.3 and 4.2 us
makeRe, a glob not seen before 246 us against 14 us 693 us against 33 us
makeRe, a glob seen before 6.0 us against 4.3 us 16.2 us against 6.8 us
makeRe, *a x 100, fresh process 4.1 ms against 0.27 ms 5.3 ms against 0.30 ms
makeRe, *a x 3000, fresh process 11.5 ms against 3.2 ms 28.2 ms against 5.5 ms

So ordinary globs cost the same per call, and a glob's first compile costs about twenty times more (about 230 us, once for each different glob). The globs that could backtrack are slower per call in exchange for a bound: two to five times on most names, and about forty to sixty times where the name is left to the matcher. A very large glob costs a few milliseconds more to compile: its regex is read once, and about 4 ms goes to classifying before the cap stops it.

Memory

makeRe('+(*w' + i + ')').test('xxxxxx/') for i up to 40,000, each regex dropped after its call, heap after a collection. The loop is from the review below.

distinct globs master this PR
10,000 8 MB 7 MB
20,000 11 MB 6 MB
40,000 11 MB 6 MB

A name that takes a DFA past its state limit

+(*a)?????????????? has more than 4,000 reachable states. One call on a 9,015-character name of a and b that matches reaches them, in 37 ms with one restart of the table. The near miss a x 42 + / then takes 0.1 ms, as it did before that name, and so does a x 20000 + /.

Limits

  • String.prototype.split builds a new RegExp from the one it is given, by the spec, so it still backtracks. test, exec, match, replace and search are covered.
  • A source the reader does not handle (lookbehind, backreferences, \b, flags other than i) gets the plain RegExp, as before.
  • A regex whose DFA has more than 4,000 reachable states works states out again after each restart of its table, so names that keep reaching new states cost a derivative per character, not a table read.
  • A regex too large to classify within the cap gets the DFA for every input, even where its backtracking would have been harmless, so it pays the slower per-call cost.
  • The derivative of a term still takes a call per optional part in a row. A chain too deep for the stack (measured: ?(a) repeated 3,000 times, where 500 is fine) is caught, and that regex answers alone from then on, as it does on master. Groups nested thousands deep are not read at all and get the plain RegExp.
  • The DFA's work per character grows with the number of loops and optional parts in the glob. *a repeated 3,000 times takes about 2 s for one near miss of 3,002 characters, where master does not finish. ?(a) repeated 377 times takes about 300 ms on a name that matches, where master takes 8 ms, and repeated 987 times about 3 s on a matching name of 144 characters, where master takes 15 ms, and 7.5 s on one of 987. Globs of that size are made up; none was found in a project.
  • The marks of the matcher behind exec() take memory in proportion to the regex and the name: about 180 bytes per character for @(+(*a)c|*b), 180 MB on a name of a million characters. They are dropped when the call returns. A regex with more than 50,000 steps written out, or with loops that can be empty nested more than eight deep, keeps its own exec() on names that match.
  • The regex is not let run on a name where a loop's body can be empty, as in +(!(a)), and the bound is loose where a loop is inside a lookahead, as in !(+(*a)). Names that match such globs are left to the matcher, at 3 to 4 us for a short one.
  • A matching name of more than 1,000 characters under the contains option has its groups from the matcher, which takes 7.7 ms on b x 40000 + a for *a, where the regex takes under 0.1 ms.
  • The class of a regex with lookaheads is an upper bound, so a glob can be called polynomial and never show it. **/!(*.test|*.spec).{js,ts} is called polynomial and pays the cost above; none of the 7 kinds of near miss tried, up to 8,000 characters, took the regex more than 0.1 ms.
  • That DFA construction ends, and that the classifier never calls a risky regex safe, are shown by tests, not proved.
  • This is about worst-case time. Whether that is a risk depends on who supplies the globs and the names in a given project.

Tests

test/bounded.js adds 35 tests: plain RegExp for globs that cannot backtrack badly; near misses that finish, in a child process with a deadline; a glob of 300 stars that compiles and answers; a chain of 55 optional groups; source, flags, prototype and capture groups kept; the same answers as the regex alone; a glob of 30,000 characters; a chain too deep for the stack; a near miss after a name has taken the DFA past its limit; the same answers with a table of 2, 3 and 7 states; the heap after 10,000 distinct globs; the class and the readings of lookahead bodies; matching names that finish in test, exec, match, search, replace and isMatch; the match and groups of the regex alone on every name of up to five characters; the engine's order on regexes picked to be hard; steps in proportion to the name; the count that lets the regex run held to a backtracker that counts its steps, on 972 regexes; what that count keeps; the contains option; slow parts that a separator keeps apart; a bracket that matches nothing. The existing 1,998 tests pass unchanged on Node 12 to 24 and npm run lint passes. Twenty-one of the new tests fail on master, nine of them because they load a module of this PR.

The measurement script
// node growth.js <path to picomatch>
'use strict';
const { spawnSync } = require('child_process');
const lib = process.argv[2] || 'picomatch';
const CASES = [
  ['+(*a)', 'aa', 'aa'], ['*(*a)', 'a', 'aa'], ['+(*)', 'a', 'a'], ['+(a*)', 'aa', 'aa'],
  ['+(@(*a))', 'aa', 'aa'], ['+(a|*a)', 'aa', 'aaa'], ['+(a*|b)', 'aa', 'aa'], ['+(*a|b)', 'aa', 'aa'],
  ['+(!(a))', 'a', 'a'], ['*(!(f))', 'a', 'a'], ['@(*a)+', 'aa', 'aa'], ['(*a)+', 'aa', 'aa'],
  ['{*a,b}+', 'aa', 'aa'], ['*a*a*a*a*b', 'a', 'aaaaaaaa'],
  ['**/+(*.)+(spec|test).+(ts|js)?(x)', '.a', '.a'], ['src/**/*(*.)@(spec|test).[jt]s?(x)', 'src/', '.a'],
];
const child = `const re=require(process.argv[1]).makeRe(process.argv[2]);` +
  `const s=process.argv[3]+process.argv[4].repeat(Number(process.argv[5]))+'/';` +
  `const t=process.hrtime.bigint();re.test(s);console.log((Number(process.hrtime.bigint()-t)/1e6).toFixed(1))`;
for (const [glob, prefix, pump] of CASES) {
  const series = [];
  for (let k = 4; k <= 16384; k *= 2) {
    const r = spawnSync(process.execPath, ['-e', child, lib, glob, prefix, pump, String(k)], { timeout: 2000, encoding: 'utf8' });
    if (r.error) { series.push(`k=${k} over 2000 ms`); break; }
    series.push(`k=${k} ${r.stdout.trim()} ms`);
  }
  console.log(glob.padEnd(36), series.join(', '));
}

Some globs compile to a regex that backtracks without bound on an input
that almost matches: +(*a), +(a|*a), *a*a*a*a*b and others take seconds
on a few dozen characters.

toRegex now classifies the backtracking of each regex it builds. A regex
that cannot backtrack badly is returned as before, a plain RegExp. One
that can keeps its source, flags and capture groups, and gets its own
test() and exec(): the regex itself runs on inputs short enough to bound
its work, and a DFA built from the same source decides longer ones. The
parser and the regex source it emits are not changed, so no glob changes
what it matches.

The code is in lib/bounded and has no dependencies.
Classifying compares the loops of a regex in pairs, so makeRe on a glob
of a hundred stars took over a second and one of three hundred over
twenty. The classifier now counts its work and stops at 4,000 units; a
regex over that is treated as one that can backtrack and is answered by
the DFA. Ordinary globs use at most about 1,100 units.

Adds a test that compiles and answers a glob of 300 stars in a child
process with a deadline. It fails on the previous commit.

@bardrop bardrop left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I compared the DFA (dfa: 'always') with the plain regex on random globs (extglobs to depth 2, classes, braces, nocase, dot, contains, windows, ...) and short random names: 17 million comparisons with no difference. The globs that took seconds were all slow on master only. Three things came up around it, inline.

Comment thread lib/bounded/dfa.js Outdated

class TooLarge extends Error {}

const table = new Map();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table is module level and nothing ever leaves it, so every term of every glob stays in memory for the life of the process. unguardMemo here and limits in backtracking.js grow the same way.

for (let i = 0; i <= 40000; i++) {
  if (i % 10000 === 0) { global.gc(); console.log(i, Math.round(process.memoryUsage().heapUsed / 1e6) + ' MB'); }
  picomatch.makeRe('+(*w' + i + ')').test('xxxxxx/');
}
distinct globs master this PR
10,000 8 MB 41 MB
20,000 11 MB 78 MB
40,000 11 MB 156 MB

That matters for the case this PR is about, where the globs come from outside. The terms only have to be shared inside one DFA, so table and unguardMemo could be created in derivatives(tree) and go away with the regex; limits could have a size cap.

Comment thread lib/bounded/glob-regexp.js Outdated
return dfa.test(text);
} catch (err) {
if (!(err instanceof TooLarge)) throw err;
fallback = err.message;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name alone can switch the protection off, with a short glob. +(*a)?????????????? (14 ?) has more than 4,000 reachable DFA states, so one long name that matches quickly is enough, and from then on that regex backtracks on every input:

const re = picomatch.makeRe('+(*a)??????????????');
let name = '', r = 1;
for (let i = 0; i < 9000; i++) { r = (Math.imul(r, 1664525) + 1013904223) >>> 0; name += (r >>> 30) & 1 ? 'a' : 'b'; }

re.test('a'.repeat(42) + '/');      // 1 ms
re.test(name + 'a'.repeat(15));     // true, 12 ms, fallback is now set
re.test('a'.repeat(42) + '/');      // 3,699 ms, about 2x for each extra 'a' (38: 243 ms, 40: 878 ms)

The limit is listed in the PR text, but it reads as a limit on the glob, and here the glob is fixed and only the name is hostile.

When the limit is hit, the machine could drop terms, index and trans and go on from the current term as the only state (RE2 does this with its cache). That keeps memory bounded and the time linear, and the fallback is not needed.

Comment thread lib/bounded/dfa.js Outdated
if (seen.has(t.id)) return;
seen.add(t.id);
if (t.k === 'chars') sets.push(t.set);
for (const c of [t.a, t.b, t.y, ...(t.items || [])]) if (c) collect(c);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collect recurses once per item of the sequence, so a long glob now throws from the matcher where master answers:

picomatch('a'.repeat(9000) + '*b*c*')('a'.repeat(9000) + 'bxx');
// master: false
// this PR: RangeError: Maximum call stack size exceeded

7,000 characters is already enough here (Node 24, default stack), and the default maxLength is 65,536. unguard and seq recurse along the sequence too. Catching RangeError next to TooLarge would stop the throw, but a loop over an explicit stack in collect keeps these globs on the DFA.

- The term table was module level, so every term of every glob stayed for
  the life of the process. It now belongs to one DFA. Kept limits are
  capped at 1,000 sources of at most 2,000 characters.
- A DFA past 4,000 states handed the regex back for every later input, and
  one long name was enough to get there. At the limit the table is now
  emptied and started again from the start state and the state reached.
- The sequence builder, the guard remover and the set collector took a call
  per term and overflowed the stack on a glob of 9,000 characters. They
  walk in loops. A stack overflow that still happens, in the reader or in
  a derivative, leaves the answer to the plain regex.
A regex with no loop is linear, and its bound can still be out of reach:
?(a) repeated 55 times reads one prefix in about 2 to the 52nd ways. It
came back as the plain RegExp and gave no answer in 2 s on 'a' x 144.

The readings of a prefix are now counted for every such regex, and one
with more than 16 gets the DFA for every input. Ordinary globs have at
most 7.
@aoikisan

Copy link
Copy Markdown
Author

Hi @bardrop,

thanks for taking the time to take a look at the work, out of curiosity what was the part the intrigued you the most about this piece? I am always interested in hearing what other people look for when they go through a change like this.

all three reproduce here as written and the branch now changes each one. numbers are from your snippets on Node 24.19.0.

memory: the term table and the unguard memo are made per DFA now and go away with the regex. limits keeps at most 1,000 sources, oldest dropped first, and none longer than 2,000 characters. your loop reads 6 MB at 10,000, 20,000 and 40,000 globs, against 8, 11 and 11 MB on master.

state limit: at 4,000 states the table is emptied and started again from the start state and the state just reached, with their terms made again in a fresh table. the fallback for that case is gone. In your snippet the long name takes 37 ms with one restart, and 'a'.repeat(42) + '/' after it takes 0.1 ms. there is a test that runs a short list of globs with a table of 2, 3 and 7 states and compares each answer with the regex alone.

stack: seq, unguard and collect walk in loops. 'a'.repeat(9000) + '*b*c*' answers false, and the same glob at 30,000 characters answers as master does.

after that I ran one glob shape at a time over a grid of glob sizes and name lengths, on master and on the branch, and it turned up more.

?(a) repeated 55 times has no loop, so it was classed as unable to backtrack badly and came back as the plain RegExp. on 'a'.repeat(144) it gave no answer in 2 s, here and on master. that one is fixed, the readings of a prefix are now counted for such a regex and past 16 it gets the DFA. the same call takes 8 ms. the count roughly doubles the cost of a glob's first compile, the description has the new numbers.

two things are not fixed and both are in the description's limits:

  • D and N still take a call per optional part in a row, so ?(a) repeated 3,000 times overflows the stack where 500 does not. that RangeError is caught and the regex answers alone from then on, same as master. groups nested 3,000 deep overflow the reader and get the plain RegExp.
  • very long chains are slow on the DFA. ?(a) repeated 987 times gives no answer in 2 s on a matching name of 144 characters, where master takes 20 ms; at 377 repeats it takes about 300 ms against 8 ms. *a repeated 3,000 times takes about 2 s for one near miss, where master does not finish.

@aoikisan aoikisan changed the title fix: linear-time RegExp for globs whose regex backtracks fix: bound backtracking in test() and exec() for globs whose regex backtracks Nov 30, 2026
- The classifier did not look inside a lookahead, so !(+(*a)) was called
  linear and got the plain RegExp. Each body is now classified as a regex
  of its own and its work added.
- When the DFA said yes, exec() ran the regex for its groups, and the
  regex can take exponential time before the match: @(+(*a)c|*b) on
  'a' x 40 + 'b' gave no answer in 20 s through isMatch. The groups now
  come from a matcher that follows the engine's order and marks each place
  that failed, so no step is taken twice.

A matching name on an exponential glob costs 0.7 to 4.4 us, where the
regex takes under 0.1.

The tests get one timeout of their own: one took up to 1.8 s of mocha's
default 2 s.
The groups of a matching name came from a matcher that steps in
JavaScript: 4.4 us for a test file on the Jest glob, where the regex takes
0.06. The ways the regex can read the name at hand are now counted along
it, and the regex runs where the work they allow is small. The same name
takes 0.16 us.

A loop whose body can be empty, as in +(!(a)), is still left to the
matcher.
With the contains option the regex has no ^ and is tried from every
start. The classifier read it from one, so *a was called linear and got
the plain RegExp, which takes 336 ms on a near miss of 40,000 letters and
four times that for each doubling. A polynomial one got a limit one power
too high.
The classifier chained two slow parts only where one ended in the loop
the next began with, so *a*a/*a*a/*a*a was called quadratic and got the
plain regex up to 1,000 characters. It is n^4: a 996 character name took
32 seconds, as it does without this branch.

A glob with a bracket that matches nothing, such as {[^\w\W]*a*a,lib},
made the classifier throw, and toRegex turned that into a regex that
matches nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants