-
-
Notifications
You must be signed in to change notification settings - Fork 2
Convert oxc parser to use parseSync for improved performance #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@copilot Can you run this too? |
... Done! Benchmark results for oxc-ts parser on combined .js and .ts files: With index.mjs: 9.495s real, 13.432s user The browser build is slightly faster in wall-clock time (9.352s vs 9.495s) but uses more CPU time (13.954s vs 13.432s user). |
|
Co-authored-by: fisker <172584+fisker@users.noreply.github.com>
Done! Updated oxc parser to use Performance results after changes: index.mjs: 9.137s real, 12.803s user (3.8% faster than async version) The synchronous version shows consistent performance improvements, especially for the Node.js build which saves ~630ms and ~4.7% CPU time. |
|
@copilot Let's update the test command to And compare both sync and async version |
... Done! Ran benchmarks with Async version (parse):
Sync version (parseSync):
The sync version shows consistent improvements, with the Node.js build gaining the most significant performance boost (258ms faster real time, 15.5% less system time). |
Description
Converts the oxc parser implementation from asynchronous
parseto synchronousparseSync, improving parsing performance for JavaScript and TypeScript files.Changes Made
Updated
src/language-js/parse/oxc.js:parsetoparseSyncfromoxc-parserparseWithOptions,parseJs, andparseTsfrom async to sync functionstryCombinationswithtryCombinationsSyncUpdated
scripts/build/build-oxc-wasm-parser.js:{parseSync as parse}to{parseSync}for consistencyPerformance Improvements
Comprehensive benchmark results for oxc-ts parser on
**/*.{js,ts}files using--experimental-cli --no-cacheflags:Async version (using
parse):index.mjs: 8.236s real, 27.169s user, 2.051s sysindex.browser.mjs: 8.513s real, 29.168s user, 1.520s sysSync version (using
parseSync):index.mjs: 7.978s real, 26.922s user, 1.733s sys (~3.1% faster, 15.5% less system time)index.browser.mjs: 8.435s real, 28.783s user, 1.532s sys (~0.9% faster, 1.3% less CPU time)The synchronous version shows consistent performance improvements across both builds. The Node.js build demonstrates the most significant gains with 258ms faster real time and a 15.5% reduction in system time. Testing with the experimental CLI and no cache provides a clearer view of actual parser performance.
Checklist
docs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.