Skip to content

test(benchmark): add compilation stage benchmark cases#13702

Open
LingyuCoder wants to merge 8 commits intomainfrom
codex/compilation-stage-benches
Open

test(benchmark): add compilation stage benchmark cases#13702
LingyuCoder wants to merge 8 commits intomainfrom
codex/compilation-stage-benches

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

Summary

Add stage-isolated Rust CodSpeed benchmark cases in xtask/benchmark/benches/groups/compilation_stages.rs for:

  • rust@mangle_exports
  • rust@runtime_requirements
  • rust@create_full_hash
  • rust@create_chunk_assets
  • rust@create_module_assets
  • rust@real_content_hash

This also adds the benchmark-local setup/reset helpers needed to keep those stages isolated without changing rspack_core public visibility.

Related links

  • N/A

Validation

  • cargo check -p rspack_benchmark --bench benches
  • cargo fmt --all --check

Known limitations

  • Some of the new benches use benchmark-local mirrors of private compilation pass logic to avoid widening rspack_core API visibility.
  • The runtime_requirements and create_chunk_assets benches may still differ from the exact production execution model in scheduling/parallelism overhead, so they should be treated as draft until that fidelity is reviewed.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

📦 Binary Size-limit

Comparing eb0197d to chore(release): release 2.0.0-rc.2 (#13697) by harpsealjs

🎉 Size decreased by 6.97KB from 49.39MB to 49.38MB (⬇️0.01%)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Rsdoctor Bundle Diff Analysis

⚠️ Note: The latest commit (b8cba8dcd7) does not have baseline artifacts. Using commit fff3f0f9b8 for baseline comparison instead. If this seems incorrect, please wait a few minutes and try rerunning the workflow.

Found 6 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB 0
react-10k 5.7 MB 0
react-1k 826.2 KB 0
react-5k 2.7 MB 0
rome 984.1 KB 0
ui-components 5.0 MB 0

Generated by Rsdoctor GitHub Action

@LingyuCoder LingyuCoder force-pushed the codex/compilation-stage-benches branch from 63037a3 to bc21247 Compare April 14, 2026 08:08
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 14, 2026

Merging this PR will degrade performance by 2.3%

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 25 untouched benchmarks
🆕 6 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation rust@mangle_exports N/A 11.8 ms N/A
Simulation rust@create_chunk_ids 10.5 ms 10.2 ms +2.92%
Simulation rust@concatenate_module_code_generation 138.1 ms 139.9 ms -1.34%
🆕 Simulation rust@real_content_hash N/A 34.5 ms N/A
🆕 Simulation rust@create_chunk_assets N/A 3.9 ms N/A
🆕 Simulation rust@runtime_requirements N/A 57.4 ms N/A
🆕 Simulation rust@create_module_assets N/A 798.2 µs N/A
🆕 Simulation rust@create_full_hash N/A 7 ms N/A
Simulation rust@persistent_cache_restore_after_single_file_change@basic-react-development 27.4 ms 28 ms -2.3%

Comparing codex/compilation-stage-benches (eb0197d) with main (fff3f0f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (c925441) during the generation of this report, so fff3f0f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@LingyuCoder LingyuCoder force-pushed the codex/compilation-stage-benches branch from 8ccd56d to 248fd9c Compare April 15, 2026 04:58
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 15, 2026

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 248fd9c
Status: ✅  Deploy successful!
Preview URL: https://f8220905.rspack-v2.pages.dev
Branch Preview URL: https://codex-compilation-stage-benc.rspack-v2.pages.dev

View logs

@LingyuCoder LingyuCoder marked this pull request as ready for review April 15, 2026 07:15
Copilot AI review requested due to automatic review settings April 15, 2026 07:15
Copy link
Copy Markdown
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.

Pull request overview

Adds new stage-isolated Rust CodSpeed benchmark cases to measure individual compilation passes, along with benchmark-local setup/reset helpers to keep each stage’s measurement focused.

Changes:

  • Add new benchmarks for several compilation stages (mangle exports, runtime requirements, full hash, module assets, chunk assets, real content hash).
  • Add benchmark-local helpers to prepare/reset compilation state between iterations.
  • Expose several internal compilation pass types (and DisableCache) via new public re-exports in rspack_core.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
xtask/benchmark/benches/groups/compilation_stages.rs Adds new stage benchmarks and helpers to snapshot/reset compilation state and run individual passes.
crates/rspack_core/src/compilation/mod.rs Publicly re-exports multiple pass types from private compilation modules.
crates/rspack_core/src/cache/mod.rs Publicly re-exports DisableCache to support benchmarks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb0197d1b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants