Skip to content

test(package/codegen): add benchmark with sourcemaps - #25772

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/08-15-test_package_codegen_add_benchmark_with_sourcemaps
Aug 18, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
om/08-15-test_package_codegen_add_benchmark_with_sourcemaps

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Aug 17, 2026

Copy link
Copy Markdown
Member

Add benchmarks for source maps in oxc-codegen.

2 benchmarks:

  1. Full end-to-end.
  2. Without the actual sourcemap generation at the end.

The 2nd is to measure the overhead that pushing to the sourcemap arrays adds while printing in isolation.

overlookmotel commented Aug 17, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel
overlookmotel marked this pull request as ready for review August 17, 2026 08:43
Copilot AI lite review requested due to automatic review settings August 17, 2026 08:43
@overlookmotel overlookmotel added the A-codegen Area - Code Generation label Aug 17, 2026
@overlookmotel
overlookmotel requested a review from camc314 August 17, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Vitest benchmarks in packages/codegen to measure the performance impact of source map support in oxc-codegen, including a variant that skips the final mapping emission pass to isolate the printer’s mapping-recording overhead.

Changes:

  • Add a new benchmark build flag (BENCHMARKS) and a benchmarks-only skipSourcemapGeneration switch to optionally skip emitMappings in source-map builds.
  • Add a shared AST loc synthesizer utility and reuse it from the existing source map tests and the new benchmarks.
  • Add @jridgewell/gen-mapping as a dev dependency and wire up pnpm run bench to build the benchmark variant and run Vitest benches.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks the new @jridgewell/gen-mapping dev dependency for codegen benchmarks.
packages/codegen/tsdown.config.ts Introduces BENCHMARKS global define used to enable benchmark-only behavior in builds.
packages/codegen/test/utils/locs.ts New shared helper to synthesize loc data from start/end offsets for sourcemap paths.
packages/codegen/test/source-maps.test.ts Switches tests to use the shared addLocs helper.
packages/codegen/src-js/print/index.ts Adds benchmark-only gate to optionally skip emitMappings (skipSourcemapGeneration).
packages/codegen/src-js/globals.d.ts Declares BENCHMARKS build-time global for the JS printer builds.
packages/codegen/package.json Adds build-bench/bench scripts and the @jridgewell/gen-mapping dev dependency.
packages/codegen/bench.bench.ts Adds 3 benchmark variants (no sourcemaps / full sourcemaps / sourcemaps without emitting).
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/codegen/test/utils/locs.ts Outdated
Comment thread packages/codegen/bench.bench.ts Outdated
Comment thread packages/codegen/bench.bench.ts Outdated
@overlookmotel

Copy link
Copy Markdown
Member Author

@camc314 Now rebased on current main.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Aug 18, 2026

camc314 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Merge activity

Add benchmarks for source maps in `oxc-codegen`.

2 benchmarks:

1. Full end-to-end.
2. Without the actual sourcemap generation at the end.

The 2nd is to measure the overhead that pushing to the sourcemap arrays adds while printing in isolation.
@graphite-app
graphite-app Bot force-pushed the om/08-15-test_package_codegen_add_benchmark_with_sourcemaps branch from e3b6c62 to ea28801 Compare August 18, 2026 16:17
@graphite-app
graphite-app Bot merged commit ea28801 into main Aug 18, 2026
29 checks passed
@graphite-app
graphite-app Bot deleted the om/08-15-test_package_codegen_add_benchmark_with_sourcemaps branch August 18, 2026 16:24
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo