Remove internal tokenization during parse by blakeembrey · Pull Request #435 · pillarjs/path-to-regexp (original) (raw)

@blakeembrey

Removes the internal LexToken created during parse, reducing the memory and performance overhead of generating the objects.

@codecov

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.74%. Comparing base (9a78879) to head (2215cd0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

@@ Coverage Diff @@ ## master #435 +/- ##

Coverage 99.74% 99.74%

Files 1 1
Lines 392 393 +1
Branches 150 156 +6

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:

@blakeembrey

Perf on main:

 ✓ src/index.bench.ts > parse 680ms
     name                   hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · parsing paths  407,427.20  0.0021  1.8551  0.0025  0.0023  0.0042  0.0057  0.0404  ±1.01%   203714

Perf on PR:

 ✓ src/index.bench.ts > parse 696ms
     name                   hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · parsing paths  515,135.45  0.0016  8.4582  0.0019  0.0018  0.0036  0.0052  0.0168  ±3.35%   257568

Base automatically changed from be/error-backslash to master

April 1, 2026 19:30

@blakeembrey

@blakeembrey

Also a bundle size reduction from 1.98 kB to 1.93 kB

@blakeembrey

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})