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

TODO: update the below for latest updates (again)

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          17.923µ ± 2%   3.911µ ± 2%  -78.18% (p=0.000 n=10)
ReadDirectory/WildcardIncludes         37.888µ ± 2%   7.440µ ± 2%  -80.36% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard        32.860µ ± 2%   4.482µ ± 2%  -86.36% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes    56.973µ ± 1%   7.015µ ± 1%  -87.69% (p=0.000 n=10)
ReadDirectory/ComplexPattern            66.58µ ± 2%   18.64µ ± 1%  -72.00% (p=0.000 n=10)
ReadDirectory/DottedFolders            32.169µ ± 2%   6.457µ ± 1%  -79.93% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     15.447µ ± 2%   2.662µ ± 2%  -82.77% (p=0.000 n=10)
ReadDirectory/NoIncludes                5.752µ ± 1%   2.493µ ± 1%  -56.66% (p=0.000 n=10)
ReadDirectory/MultipleRecursive        31.029µ ± 3%   5.041µ ± 2%  -83.76% (p=0.000 n=10)
ReadDirectory/LargeFileSystem         1488.46µ ± 1%   71.14µ ± 1%  -95.22% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           1937.88µ ± 1%   95.03µ ± 2%  -95.10% (p=0.000 n=10)
geomean                                 57.25µ        8.813µ       -84.61%
                                    │    old.txt    │               new.txt                │
                                    │     B/op      │     B/op      vs base                │
ReadDirectory/LiteralIncludes          4.555Ki ± 0%   2.180Ki ± 0%  -52.14% (p=0.000 n=10)
ReadDirectory/WildcardIncludes         8.384Ki ± 0%   4.023Ki ± 0%  -52.01% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard        4.469Ki ± 0%   1.547Ki ± 0%  -65.38% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes    7.001Ki ± 0%   2.984Ki ± 0%  -57.37% (p=0.000 n=10)
ReadDirectory/ComplexPattern           17.75Ki ± 0%   10.23Ki ± 0%  -42.39% (p=0.000 n=10)
ReadDirectory/DottedFolders            6.391Ki ± 0%   2.547Ki ± 0%  -60.15% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     3.508Ki ± 0%   1.406Ki ± 0%  -59.91% (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.094Ki ± 0%  -66.37% (p=0.000 n=10)
ReadDirectory/LargeFileSystem          72.23Ki ± 0%   12.15Ki ± 0%  -83.18% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           105.42Ki ± 0%   21.24Ki ± 0%  -79.85% (p=0.000 n=10)
geomean                                9.193Ki        3.502Ki       -61.91%
                                    │   old.txt   │              new.txt               │
                                    │  allocs/op  │ allocs/op   vs base                │
ReadDirectory/LiteralIncludes         154.00 ± 0%   44.00 ± 0%  -71.43% (p=0.000 n=10)
ReadDirectory/WildcardIncludes        249.00 ± 0%   90.00 ± 0%  -63.86% (p=0.000 n=10)
ReadDirectory/RecursiveWildcard       142.00 ± 0%   38.00 ± 0%  -73.24% (p=0.000 n=10)
ReadDirectory/RecursiveWithExcludes   182.00 ± 0%   59.00 ± 0%  -67.58% (p=0.000 n=10)
ReadDirectory/ComplexPattern           571.0 ± 0%   186.0 ± 0%  -67.43% (p=0.000 n=10)
ReadDirectory/DottedFolders           137.00 ± 0%   53.00 ± 0%  -61.31% (p=0.000 n=10)
ReadDirectory/CommonPackageFolders     98.00 ± 0%   29.00 ± 0%  -70.41% (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%   42.00 ± 0%  -71.62% (p=0.000 n=10)
ReadDirectory/LargeFileSystem         1022.0 ± 0%   200.0 ± 0%  -80.43% (p=0.000 n=10)
ReadDirectory/LargeAllFiles           1251.0 ± 0%   338.0 ± 0%  -72.98% (p=0.000 n=10)
geomean                                228.6        71.75       -68.61%

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