Skip to content

perf(parse): resolve 40% performance regression by using positional capture groups - #298

Open
vjymisal0 wants to merge 1 commit into
vercel:mainfrom
vjymisal0:perf-optimize-regex-clean
Open

perf(parse): resolve 40% performance regression by using positional capture groups#298
vjymisal0 wants to merge 1 commit into
vercel:mainfrom
vjymisal0:perf-optimize-regex-clean

Conversation

@vjymisal0

Copy link
Copy Markdown

Fixes #273.

The recent TypeScript rewrite in \�4.0.0\ introduced a significant performance regression (>40% slower) during parsing, which was tracked down to the use of named capture groups (?\ and ?). Executing Regex with named capture groups incurs substantial overhead in V8 compared to standard positional capture groups.

By replacing the named capture groups with simple positional groups, we restore the \ms\ parsing performance back to its pre-\�4.0.0\ baseline while keeping 100% of the TypeScript safety and logic. All tests still pass!

Copilot AI lite review requested due to automatic review settings August 20, 2026 16:17

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Performance Regression: v4.0.0 is >40% slower than v2.1.3

3 participants