Skip to content
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

perf: into_binding_chunk_modules when chunk is large #3267

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

IWANABETHATGUY
Copy link
Contributor

@IWANABETHATGUY IWANABETHATGUY commented Dec 30, 2024

benchmark/apps/10000

Before

image

profile

image
image
The to_napi_value cost about 130ms, seems napi has huge overhead when convert complex HashMap to
JsObject

After

image
image
the to_napi cost is gone

Copy link
Contributor Author

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

@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-30-perf_simplify_rendered_modules_to_napi branch 2 times, most recently from 17e84d8 to c55b5b4 Compare December 30, 2024 10:19
@IWANABETHATGUY IWANABETHATGUY changed the title perf: simplify rendered_modules to napi perf: into_binding_chunk_modules when chunk is large Dec 30, 2024
@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-30-perf_simplify_rendered_modules_to_napi branch from c55b5b4 to 3c04a39 Compare December 30, 2024 10:20
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review December 30, 2024 10:32
Copy link

github-actions bot commented Dec 30, 2024

Benchmarks Rust

  • target: main(66c0083)
  • pr: 12-30-perf_simplify_rendered_modules_to_napi(1beb081)
group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.00     73.0±1.26ms        ? ?/sec    1.02     74.7±1.55ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.00     96.6±1.33ms        ? ?/sec    1.02     98.3±2.11ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.00    109.6±2.53ms        ? ?/sec    1.00    109.1±1.90ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.00     83.6±1.82ms        ? ?/sec    1.01     84.8±2.32ms        ? ?/sec
bundle/bundle@rome-ts                                               1.00    123.4±1.50ms        ? ?/sec    1.01    124.2±1.82ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.00    202.7±3.12ms        ? ?/sec    1.02   207.1±10.49ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.00    242.4±6.62ms        ? ?/sec    1.01    244.6±4.60ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.01    136.6±1.41ms        ? ?/sec    1.00    135.3±1.81ms        ? ?/sec
bundle/bundle@threejs                                               1.00     40.8±1.13ms        ? ?/sec    1.10     44.9±0.64ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.00     94.6±1.52ms        ? ?/sec    1.05     98.9±1.97ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.00    110.8±1.32ms        ? ?/sec    1.05    116.9±1.71ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.00     50.7±0.45ms        ? ?/sec    1.06     53.5±0.78ms        ? ?/sec
bundle/bundle@threejs10x                                            1.00   445.9±17.97ms        ? ?/sec    1.03    457.0±4.65ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.00  1112.7±10.83ms        ? ?/sec    1.00  1113.7±14.97ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.01   1278.6±7.87ms        ? ?/sec    1.00   1260.8±7.06ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.00    513.6±4.30ms        ? ?/sec    1.03    527.5±5.32ms        ? ?/sec
remapping/remapping                                                 1.00     25.4±1.13ms        ? ?/sec    1.05     26.7±0.63ms        ? ?/sec
remapping/render-chunk-remapping                                    1.02     73.6±5.12ms        ? ?/sec    1.00     72.2±3.23ms        ? ?/sec
scan/scan@rome-ts                                                   1.00     98.4±1.35ms        ? ?/sec    1.01     99.1±1.62ms        ? ?/sec
scan/scan@threejs                                                   1.00     31.3±0.61ms        ? ?/sec    1.01     31.5±0.53ms        ? ?/sec
scan/scan@threejs10x                                                1.00    320.0±4.29ms        ? ?/sec    1.01    322.6±4.75ms        ? ?/sec

### Description

When using `gracefulCancel: true`, the termination signal can only be
obtained via `getCancelSignal`, but our watch implementation uses
`onExit`, which causes the process to never terminate.

```bash
Error: Build failed with 1 error:
[plugin shim]
Error: EBUSY: resource busy or locked, copyfile 'D:\shulaoda\rolldown\packages\rolldown\src\rolldown-binding.win32-x64-msvc.node' -> 'D:\shulaoda\rolldown\packages\rolldown\dist\shared\rolldown-binding.win32-x64-msvc.node'
```


![image](https://github.com/user-attachments/assets/5dfe157c-6b09-46aa-bd6f-9dae8eafe783)
@IWANABETHATGUY IWANABETHATGUY force-pushed the 12-30-perf_simplify_rendered_modules_to_napi branch from 3c04a39 to 1beb081 Compare December 30, 2024 10:43
@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Dec 30, 2024
Merged via the queue into main with commit c7582a6 Dec 30, 2024
21 of 22 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 12-30-perf_simplify_rendered_modules_to_napi branch December 30, 2024 11:04
github-merge-queue bot pushed a commit that referenced this pull request Dec 31, 2024
### Description

Related to #3267

After completing the relevant tests, run `just lint`:

```bash
[lint-prettier] [warn] packages/rolldown/tests/cli/fixtures/config-multiply-options/watch-dist-options/cjs.js
[lint-prettier] [warn] packages/rolldown/tests/cli/fixtures/config-multiply-options/watch-dist-options/esm.js
[lint-prettier] [warn] packages/rolldown/tests/cli/fixtures/config-multiply-output/watch-dist-output/cjs.js
[lint-prettier] [warn] packages/rolldown/tests/cli/fixtures/config-multiply-output/watch-dist-output/esm.js
[lint-prettier] [warn] Code style issues found in 4 files. Run Prettier with --write to fix.
[lint-prettier]  ELIFECYCLE  Command failed with exit code 1.
ERROR: "lint-prettier" exited with 1.
```
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.

3 participants