Skip to content

Conversation

@jakebailey
Copy link
Member

@jakebailey jakebailey commented Dec 17, 2025

This is a total redo of #1483.

After this PR, our use of regexp/regexp2 is limited to:

  • Tests
  • UnquoteString (which is documented as being implemented incorrectly)
  • semver parsing
  • HTML entity parsing in the JSX transform
  • Some complicated code in modulespecifiers to handle auto-import regexes (probably not removable).

I have also tried to make a concurrent version like what tsgolint patches in, but it's a net negative in the new code. Hopefully this means it's not needed?

TODO: Delete the old implementation and move code

goos: linux
goarch: amd64
pkg: github.com/microsoft/typescript-go/internal/vfs/vfsmatch
cpu: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
                                    │    old.txt    │               new.txt               │
                                    │    sec/op     │   sec/op     vs base                │
ReadDirectory/LiteralIncludes          16.992µ ± 1%   3.470µ ± 1%  -79.58% (p=0.000 n=10)
ReadDirectory/WildcardIncludes         36.168µ ± 1%   6.826µ ± 1%  -81.13% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard        30.665µ ± 2%   4.236µ ± 2%  -86.19% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes    53.729µ ± 1%   6.489µ ± 1%  -87.92% (p=0.000 n=10)
ReadDirectory/ComplexPattern            64.74µ ± 1%   16.67µ ± 1%  -74.26% (p=0.000 n=10)
ReadDirectory/DottedFolders            30.470µ ± 1%   6.006µ ± 1%  -80.29% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     14.263µ ± 1%   2.488µ ± 1%  -82.56% (p=0.000 n=10)
ReadDirectory/NoIncludes                5.399µ ± 1%   2.361µ ± 1%  -56.27% (p=0.000 n=10)
ReadDirectory/MultipleRecursive        29.482µ ± 1%   4.673µ ± 1%  -84.15% (p=0.000 n=10)
ReadDirectory/LargeFileSystem         1381.34µ ± 1%   65.98µ ± 0%  -95.22% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           1802.40µ ± 2%   89.08µ ± 1%  -95.06% (p=0.000 n=10)
geomean                                 53.96µ        8.148µ       -84.90%
                                    │    old.txt    │               new.txt                │
                                    │     B/op      │     B/op      vs base                │
ReadDirectory/LiteralIncludes          4.555Ki ± 0%   2.133Ki ± 0%  -53.17% (p=0.000 n=10)
ReadDirectory/WildcardIncludes         8.384Ki ± 0%   3.977Ki ± 0%  -52.57% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard        4.469Ki ± 0%   1.531Ki ± 0%  -65.73% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes    7.001Ki ± 0%   2.953Ki ± 0%  -57.82% (p=0.000 n=10)
ReadDirectory/ComplexPattern          17.752Ki ± 0%   9.883Ki ± 0%  -44.33% (p=0.000 n=10)
ReadDirectory/DottedFolders            6.391Ki ± 0%   2.531Ki ± 0%  -60.39% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     3.508Ki ± 0%   1.391Ki ± 0%  -60.36% (p=0.000 n=10)
ReadDirectory/NoIncludes               1.758Ki ± 0%   1.211Ki ± 0%  -31.11% (p=0.000 n=10)
ReadDirectory/MultipleRecursive        6.227Ki ± 0%   2.078Ki ± 0%  -66.62% (p=0.000 n=10)
ReadDirectory/LargeFileSystem          72.23Ki ± 0%   12.09Ki ± 0%  -83.26% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           105.41Ki ± 0%   21.21Ki ± 0%  -79.88% (p=0.000 n=10)
geomean                                9.193Ki        3.464Ki       -62.32%
                                    │   old.txt   │              new.txt               │
                                    │  allocs/op  │ allocs/op   vs base                │
ReadDirectory/LiteralIncludes         154.00 ± 0%   38.00 ± 0%  -75.32% (p=0.000 n=10)
ReadDirectory/WildcardIncludes        249.00 ± 0%   84.00 ± 0%  -66.27% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard       142.00 ± 0%   36.00 ± 0%  -74.65% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes   182.00 ± 0%   55.00 ± 0%  -69.78% (p=0.000 n=10)
ReadDirectory/ComplexPattern           571.0 ± 0%   158.0 ± 0%  -72.33% (p=0.000 n=10)
ReadDirectory/DottedFolders           137.00 ± 0%   51.00 ± 0%  -62.77% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     98.00 ± 0%   27.00 ± 0%  -72.45% (p=0.000 n=10)
ReadDirectory/NoIncludes               62.00 ± 0%   36.00 ± 0%  -41.94% (p=0.000 n=10)
ReadDirectory/MultipleRecursive       148.00 ± 0%   40.00 ± 0%  -72.97% (p=0.000 n=10)
ReadDirectory/LargeFileSystem         1022.0 ± 0%   192.0 ± 0%  -81.21% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           1251.0 ± 0%   334.0 ± 0%  -73.30% (p=0.000 n=10)
geomean                                228.6        67.24       -70.59%

Copilot AI review requested due to automatic review settings December 17, 2025 23:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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