Skip to content

Comments

feat(debug): cache large string#4882

Merged
hyf0 merged 1 commit intomainfrom
06-10-feat_debug_cache_large_string
Jun 17, 2025
Merged

feat(debug): cache large string#4882
hyf0 merged 1 commit intomainfrom
06-10-feat_debug_cache_large_string

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Jun 9, 2025

For large source code, the output looks like

{"action":"StringRef","id":"c26dcbf88ff7b8e67784f22451407d0c090d03506ff3d0475fd105a1ad2af65c","content":"import { hello } from './hello';"}
{"timestamp":1749492411137,"session_id":"1749492411088","action":"HookTransformCallStart","module_id":"/Users/yunfeihe/Documents/GitHub/rolldown/examples/basic-typescript/index.ts","source":"$ref:c26dcbf88ff7b8e67784f22451407d0c090d03506ff3d0475fd105a1ad2af65c","plugin_name":"test","plugin_index":1,"call_id":"transform_1_1749492411122"}
{"timestamp":1749492411140,"session_id":"1749492411088","action":"HookTransformCallEnd","module_id":"/Users/yunfeihe/Documents/GitHub/rolldown/examples/basic-typescript/index.ts","transformed_source":"$ref:c26dcbf88ff7b8e67784f22451407d0c090d03506ff3d0475fd105a1ad2af65c","plugin_name":"test","plugin_index":1,"call_id":"transform_1_1749492411122"}

Rolldown will ensures that StringRef action is emitted before any other event try to reference it via id.


Implementation is terrible, but I can't think of a better way under current solution. Fortunately, it doesn't affect production if debug is not enabled.

@netlify
Copy link

netlify bot commented Jun 9, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 5acd56c
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6847281b03e89b0008089995

Copy link
Member Author

hyf0 commented Jun 9, 2025

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

@hyf0 hyf0 marked this pull request as ready for review June 9, 2025 18:17
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2025

Benchmarks Rust

  • target: main(33d0832)
  • pr: 06-10-feat_debug_cache_large_string(5acd56c)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     72.8±3.33ms        ? ?/sec    1.02     74.3±1.83ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     82.5±1.87ms        ? ?/sec    1.04     85.5±3.31ms        ? ?/sec
bundle/bundle@rome_ts                                        1.02    115.5±4.66ms        ? ?/sec    1.00    112.8±1.87ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.02    133.0±2.42ms        ? ?/sec    1.00    130.1±3.76ms        ? ?/sec
bundle/bundle@threejs                                        1.00     39.7±2.21ms        ? ?/sec    1.07     42.3±0.59ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.02     47.1±0.74ms        ? ?/sec    1.00     46.3±0.86ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    429.0±6.54ms        ? ?/sec    1.00    429.9±5.22ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    498.8±4.39ms        ? ?/sec    1.02    509.8±6.73ms        ? ?/sec
scan/scan@rome_ts                                            1.00     87.0±1.14ms        ? ?/sec    1.03     89.3±1.56ms        ? ?/sec
scan/scan@threejs                                            1.00     30.8±1.84ms        ? ?/sec    1.02     31.6±1.87ms        ? ?/sec
scan/scan@threejs10x                                         1.00    319.3±4.43ms        ? ?/sec    1.01    323.8±4.94ms        ? ?/sec

@hyf0 hyf0 force-pushed the 06-10-feat_debug_cache_large_string branch from 9afe43d to 5acd56c Compare June 9, 2025 18:29
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 9, 2025

Open in StackBlitz

@rolldown/browser

npm i https://pkg.pr.new/@rolldown/browser@4882

@rolldown/debug

npm i https://pkg.pr.new/@rolldown/debug@4882

@rolldown/pluginutils

npm i https://pkg.pr.new/@rolldown/pluginutils@4882

rolldown

npm i https://pkg.pr.new/rolldown@4882

@rolldown/binding-darwin-arm64

npm i https://pkg.pr.new/@rolldown/binding-darwin-arm64@4882

@rolldown/binding-darwin-x64

npm i https://pkg.pr.new/@rolldown/binding-darwin-x64@4882

@rolldown/binding-freebsd-x64

npm i https://pkg.pr.new/@rolldown/binding-freebsd-x64@4882

@rolldown/binding-linux-arm-gnueabihf

npm i https://pkg.pr.new/@rolldown/binding-linux-arm-gnueabihf@4882

@rolldown/binding-linux-arm64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-gnu@4882

@rolldown/binding-linux-arm64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-arm64-musl@4882

@rolldown/binding-linux-x64-gnu

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-gnu@4882

@rolldown/binding-linux-x64-musl

npm i https://pkg.pr.new/@rolldown/binding-linux-x64-musl@4882

@rolldown/binding-wasm32-wasi

npm i https://pkg.pr.new/@rolldown/binding-wasm32-wasi@4882

@rolldown/binding-win32-arm64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-arm64-msvc@4882

@rolldown/binding-win32-ia32-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-ia32-msvc@4882

@rolldown/binding-win32-x64-msvc

npm i https://pkg.pr.new/@rolldown/binding-win32-x64-msvc@4882

commit: 5acd56c

Copy link
Collaborator

@antfu antfu left a comment

Choose a reason for hiding this comment

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

This did help the DevTools to load the logs a lot faster, thanks!

antfu added a commit to vitejs/devtools that referenced this pull request Jun 17, 2025
@hyf0 hyf0 added this pull request to the merge queue Jun 17, 2025
Merged via the queue into main with commit b7b71ae Jun 17, 2025
46 checks passed
@hyf0 hyf0 deleted the 06-10-feat_debug_cache_large_string branch June 17, 2025 09:43
github-actions bot pushed a commit that referenced this pull request Jun 17, 2025
## [1.0.0-beta.17] - 2025-06-17

### 🚀 Features

- binding: feat(binding): always use the same `BindingBundler` to create `BindingBundlerImpl` for the same `RolldownBuild` by @hyf0 in [#4985](#4985)
- debug: feat(debug): cache large string by @hyf0 in [#4882](#4882)
- feat: make require('./foo.json') work as expected even if the json is transformed to JS by a custom plugin by @IWANABETHATGUY in [#4984](#4984)
- feat: add diagnostic for multiple entries with UMD/IIFE formats by @shulaoda in [#4954](#4954)

### 🐛 Bug Fixes

- plugin/vite-resolve: fix(plugin/vite-resolve): importing an optional peer dep should throw an runtime error by @sapphi-red in [#4980](#4980)
- fix: upgrade napi, fix wasm url by @sxzz in [#4958](#4958)
- fix: should rewrite hmr related ast after test if `experimental.hmr` is enabled. by @IWANABETHATGUY in [#4972](#4972)

### 💼 Other

- build: provide `"type": "module"` in `package.json` by @iiio2 in [#4974](#4974)

### 🚜 Refactor

- binding: refactor(binding): rename `Bundler` to `BindingBundleImpl` by @hyf0 in [#4983](#4983)
- rolldown: refactor(rolldown): migrate to ESM package by @sxzz in [#4959](#4959)

### 📚 Documentation

- docs: explain how to transpile legacy decorators by @hyf0 in [#4989](#4989)
- code-splitting: docs(code-splitting): make terms bold instead of wrapped with inline code block by @hyf0 in [#4975](#4975)
- docs: improve advanced chunks by @hyf0 in [#4966](#4966)
- docs: refine code splitting guide by @sapphi-red in [#4969](#4969)

### 🧪 Testing

- test: place empty `package.json` to prevent all files to be treated as node mode by @sapphi-red in [#4979](#4979)

### ⚙️ Miscellaneous Tasks

- infra: chore(infra): ensure `pnpm install` for common commands by @hyf0 in [#4987](#4987)
- browser: chore(browser): add `@oxc-project/runtime` by @shulaoda in [#4988](#4988)
- deps: chore(deps): update dependency tsdown to v0.12.8 by @renovate[bot] in [#4977](#4977)
- deps: chore(deps): update npm packages (major) by @renovate[bot] in [#4963](#4963)
- deps: chore(deps): lock file maintenance npm packages by @renovate[bot] in [#4967](#4967)
- deps: chore(deps): lock file maintenance rust crates by @renovate[bot] in [#4965](#4965)
- deps: chore(deps): lock file maintenance npm packages by @renovate[bot] in [#4964](#4964)
- deps: chore(deps): update github-actions by @renovate[bot] in [#4962](#4962)

### ❤️ New Contributors

* @iiio2 made their first contribution in [#4974](#4974)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants