Skip to content

perf(rolldown_plugin_reporter): gzip size computation#5734

Merged
IWANABETHATGUY merged 1 commit intomainfrom
08-15-perf_report_plugin_gzip_size_compute
Aug 15, 2025
Merged

perf(rolldown_plugin_reporter): gzip size computation#5734
IWANABETHATGUY merged 1 commit intomainfrom
08-15-perf_report_plugin_gzip_size_compute

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Aug 15, 2025

Note

  • bench case: apps/10000 20000+ modules.
  • configuration: advanced-chunks + disabled minify

Before

I noticed that the gzip size computation costs a lot of time in rolldown-vite, in my local computer, it takes 158ms to compute gzip size(total building time takes about 750ms)
image

rolldown-vite v7.0.12 building for production...
✓ 20014 modules transformed.
vite-dist/index.html                               0.62 kB │ gzip:   0.34 kB
vite-dist/assets/rolldown-runtime-DWGyDpL3.js      1.12 kB │ gzip:   0.55 kB
vite-dist/assets/react-jrohfdTy.js               207.41 kB │ gzip:  54.06 kB
vite-dist/assets/index-BROXgPrc.js             3,901.62 kB │ gzip: 323.08 kB
vite-dist/assets/other-libs-BVAwKXhJ.js        6,680.16 kB │ gzip: 938.17 kB
✓ built in 755ms

After

image
rolldown-vite v7.0.12 building for production...
✓ 20014 modules transformed.
vite-dist/index.html                               0.62 kB │ gzip:   0.34 kB
vite-dist/assets/rolldown-runtime-DWGyDpL3.js      1.12 kB │ gzip:   0.56 kB
vite-dist/assets/react-jrohfdTy.js               207.41 kB │ gzip:  54.25 kB
vite-dist/assets/index-BUf1zkMf.js             3,901.62 kB │ gzip: 323.61 kB
vite-dist/assets/other-libs-BVAwKXhJ.js        6,680.16 kB │ gzip: 938.11 kB
✓ built in 648ms

The size after gzip is almost identical; it should be alright to have a little difference since it's just a gzip size used for reference.

Copy link
Member Author

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

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 15, 2025 09:37
@netlify
Copy link

netlify bot commented Aug 15, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit ed47def
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/689f0674b880a700083ded0d

@github-actions
Copy link
Contributor

github-actions bot commented Aug 15, 2025

Benchmarks Rust

  • target: main(61b0f46)
  • pr: 08-15-perf_report_plugin_gzip_size_compute(ed47def)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     83.2±2.63ms        ? ?/sec    1.01     84.4±2.31ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.03     97.3±4.42ms        ? ?/sec    1.00     94.8±2.76ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    119.8±1.52ms        ? ?/sec    1.03    123.0±2.39ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    141.3±1.49ms        ? ?/sec    1.03    145.3±3.44ms        ? ?/sec
bundle/bundle@threejs                                        1.00     44.4±1.86ms        ? ?/sec    1.05     46.5±1.22ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     55.1±2.28ms        ? ?/sec    1.02     56.4±2.44ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    479.2±6.64ms        ? ?/sec    1.00    477.5±7.99ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.01    565.5±6.98ms        ? ?/sec    1.00    561.5±8.19ms        ? ?/sec
scan/scan@rome_ts                                            1.01     97.7±2.20ms        ? ?/sec    1.00     96.7±2.12ms        ? ?/sec
scan/scan@threejs                                            1.00     34.2±0.56ms        ? ?/sec    1.03     35.2±0.67ms        ? ?/sec
scan/scan@threejs10x                                         1.00    358.1±5.38ms        ? ?/sec    1.00    356.7±6.44ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-15-perf_report_plugin_gzip_size_compute branch from 9a88fdd to 0395378 Compare August 15, 2025 09:57
@IWANABETHATGUY IWANABETHATGUY changed the title perf: report_plugin gzip size compute perf(rolldown_plugin_reporter): report_plugin gzip size compute Aug 15, 2025
@IWANABETHATGUY IWANABETHATGUY changed the title perf(rolldown_plugin_reporter): report_plugin gzip size compute perf(rolldown_plugin_reporter): gzip size computation Aug 15, 2025
@IWANABETHATGUY IWANABETHATGUY force-pushed the 08-15-perf_report_plugin_gzip_size_compute branch from 0395378 to ed47def Compare August 15, 2025 10:05
@shulaoda shulaoda self-assigned this Aug 15, 2025
@Brooooooklyn Brooooooklyn requested a review from Copilot August 15, 2025 10:24
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.

Pull Request Overview

Optimizes gzip size computation in the rolldown plugin reporter to improve build performance by parallelizing compression and using a counting writer instead of allocating compressed data.

  • Parallelizes gzip size computation across chunks and assets using rayon
  • Implements a custom CountingWriter to avoid allocating compressed data in memory
  • Updates flate2 dependency to use zlib-rs backend for better performance

Reviewed Changes

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

Show a summary per file
File Description
deny.toml Adds Zlib license to allowed list for dependency compliance
crates/rolldown_plugin_reporter/src/utils.rs Implements CountingWriter and refactors compute_gzip_size to avoid memory allocation
crates/rolldown_plugin_reporter/src/lib.rs Parallelizes gzip computation and removes sequential processing
crates/rolldown_plugin_reporter/Cargo.toml Adds rayon dependency for parallel processing
Cargo.toml Updates flate2 to use zlib-rs backend

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Brooooooklyn
Copy link
Member

cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

I'm curious to know how much this makes the Rolldown's binary size bigger (not a blocker).

@IWANABETHATGUY
Copy link
Member Author

IWANABETHATGUY commented Aug 15, 2025

Main

image # Current image increase by around 71KB

@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Aug 15, 2025
Merged via the queue into main with commit e0c3716 Aug 15, 2025
27 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 08-15-perf_report_plugin_gzip_size_compute branch August 15, 2025 13:31
This was referenced Aug 18, 2025
hyf0 pushed a commit that referenced this pull request Aug 18, 2025
## [1.0.0-beta.33] - 2025-08-18

### 💥 BREAKING CHANGES

- only call `closeBundle` hook when bundling actually happens (#5715) by
@shulaoda

### 🚀 Features

- rolldown_plugin_vite_css_post: align transform logic except minify
(#5768) by @shulaoda
- rolldown_plugin_vite_css_post: align html inline css logic (#5767) by
@shulaoda
- support merge cjs ns in module group level (#5760) by @IWANABETHATGUY
- rolldown_plugin_vite_css_post: filter transform id (#5766) by
@shulaoda
- rolldown: oxc v0.82.2 (#5754) by @Boshen
- rollup-test: log error when `pringStatus` (#5744) by @situ2001
- rolldown_plugin_vite_css_post: initialize (#5743) by @shulaoda
- rolldown_plugin_vite_css: align `transform` hook logic (#5736) by
@shulaoda
- rolldown_plugin_vite_css: align partial transform hook logic (#5733)
by @shulaoda
- add original wrap_kind (#5729) by @IWANABETHATGUY
- concatenateWrappedModule (#5724) by @IWANABETHATGUY
- rolldown: oxc v0.82.1 (#5717) by @Boshen
- improve error message for `unresolved_import` when platform is
`neutral` (#5700) by @IWANABETHATGUY

### 🐛 Bug Fixes

- rolldown_plugin_transform: merge tsconfig jsx options even when
`oxc.jsx.runtime` is set (#5771) by @hi-ogawa
- jsx preserve break component which is default export (#5764) by
@shulaoda
- rolldown_plugin_asset: should directly stringify raw content (#5749)
by @situ2001
- resolve symbol deconfliction order for cross-chunk imports by
@IWANABETHATGUY
- rolldown_error: improve resolve diagnostic message (#5740) by
@shulaoda
- vitest ci failed (#5741) by @IWANABETHATGUY
- rolldown: options `context` should be available in renderStart (#5672)
by @situ2001
- ensure lazy module eval order when import variable from other chunk
(#5727) by @IWANABETHATGUY
- wasm build panic on stackblitz (#5723) by @shulaoda
- plugin/vite-resolve: try non-prefixed id before prefixed id (#5711) by
@sapphi-red
- devtool: shouldn't filter out spans for devtool use case (#5713) by
@hyf0
- plugin/vite-resolve: fallback on more resolution errors that happened
when trying with prefix (#5710) by @sapphi-red
- plugin/vite-resolve: don't consider ids with `npm:` prefix as a
built-in module (#5709) by @sapphi-red

### 🚜 Refactor

- rolldown_plugin_json: use common plugin utils (#5769) by @shulaoda
- hmr: remove unnecessary code of handling runtime module (#5752) by
@hyf0
- hmr: enhance HMR update logic and improve clarity (#5748) by @hyf0
- improve `ScopeHoistingFinalizerContext` (#5739) by @shulaoda
- move `finalize_normal_module` into `ScopeHoistingFinalizerContext`
(#5738) by @shulaoda
- private fields `wrap_kind` and `original_wrap_kind` and keep them sync
(#5730) by @IWANABETHATGUY

### 📚 Documentation

- rolldown_plugin_data_uri: update README (#5746) by @situ2001
- install guide for minor platforms (#5716) by @sapphi-red
- update description for platform `neutral` (#5701) by @IWANABETHATGUY

### ⚡ Performance

- hmr: only refetch changed modules (#5753) by @hyf0
- rolldown_plugin_reporter: gzip size computation (#5734) by
@IWANABETHATGUY
- hmr: reuse previous ast for non-changed modules (#5725) by @hyf0
- rolldown_ecmascript: do not run semantic twice for `dce-only` (#5707)
by @Boshen

### 🧪 Testing

- rolldown: should await for `toMatchFileSnapshot` (#5759) by @situ2001
- hmr: improve test of `import.meta.hot.invalidate` (#5747) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: lock file maintenance (#5765) by @renovate[bot]
- deps: lock file maintenance rust crates (#5763) by @renovate[bot]
- deps: lock file maintenance npm packages (#5762) by @renovate[bot]
- deps: update github-actions (#5755) by @renovate[bot]
- deps: update dependency tinybench to v5 (#5756) by @renovate[bot]
- deps: update github-actions (major) (#5757) by @renovate[bot]
- deps: update crate-ci/typos action to v1.35.4 (#5714) by
@renovate[bot]
- prepare-release: regenerate `binding.js` after version bump (#5704) by
@shulaoda
- deps: update dependency tsdown to v0.14.1 (#5705) by @renovate[bot]
- rollup-tests: skip occasionally failing test case (#5703) by @shulaoda
- update binding.js (#5702) by @shulaoda

Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
graphite-app bot pushed a commit that referenced this pull request Feb 13, 2026
…rt_compressed_size` is disabled (#8321)

Related to #5734

1. Remove the unused `compressed_count` field and its reset in `render_start`
2. Skip Rayon parallel computation entirely when `report_compressed_size` is `false` (using `.then()`)
3. Simplify the "computing gzip size" log message (remove TTY-specific progress reporting)

Since #5734 removed the dynamic per-output progress reporting (`computing gzip size ({count})...`) in favor of printing the final sizes all at once, the remaining `computing gzip size (0)...` log is no longer meaningful. Additionally, with Rayon's `par_iter` and Rust's performance, gzip computation is fast enough that a progress log is unnecessary. Remove it.
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.

5 participants