Skip to content

Comments

perf(hmr): remove no-op runtime.__toCommonJS call#5089

Merged
sapphi-red merged 2 commits intomainfrom
perf/hmr-remove-no-op-runtime-to-commonjs-call
Jun 27, 2025
Merged

perf(hmr): remove no-op runtime.__toCommonJS call#5089
sapphi-red merged 2 commits intomainfrom
perf/hmr-remove-no-op-runtime-to-commonjs-call

Conversation

@sapphi-red
Copy link
Member

__rolldown_runtime__.__toCommonJS(namespace); was generated in the HMR code. But this call is no-op (the return value is not used).

var __toCommonJS = mod => __copyProps(__defProp({}, '__esModule', { value: true }), mod)
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === 'object' || typeof from === 'function')
    for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
      key = keys[i]
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: (k => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })
    }
  return to
}
var __defProp = Object.defineProperty

Also this call is slow because it copies all properties.

This seems to be added by #4461 but I'm not sure why this was added.

@netlify
Copy link

netlify bot commented Jun 27, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 535b36c
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/685e7bbaf6589800080dc4e9

@sapphi-red sapphi-red marked this pull request as draft June 27, 2025 10:33
@github-actions
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Benchmarks Rust

  • target: main(0ba87d7)
  • pr: perf/hmr-remove-no-op-runtime-to-commonjs-call(535b36c)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     80.0±2.52ms        ? ?/sec    1.01     80.6±2.00ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     89.7±3.01ms        ? ?/sec    1.02     91.3±1.92ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    115.3±3.75ms        ? ?/sec    1.01    117.0±2.12ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    135.3±2.42ms        ? ?/sec    1.02    138.0±2.73ms        ? ?/sec
bundle/bundle@threejs                                        1.01     42.0±0.87ms        ? ?/sec    1.00     41.5±1.69ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.01     52.1±0.90ms        ? ?/sec    1.00     51.5±1.39ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    446.1±6.68ms        ? ?/sec    1.00    447.1±5.92ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    520.3±8.70ms        ? ?/sec    1.00    520.0±7.40ms        ? ?/sec
scan/scan@rome_ts                                            1.01     90.6±2.27ms        ? ?/sec    1.00     90.0±1.46ms        ? ?/sec
scan/scan@threejs                                            1.00     32.2±1.76ms        ? ?/sec    1.02     32.7±2.04ms        ? ?/sec
scan/scan@threejs10x                                         1.00    326.9±5.32ms        ? ?/sec    1.01    331.3±5.96ms        ? ?/sec

@sapphi-red sapphi-red marked this pull request as ready for review June 27, 2025 11:08
Copy link
Member Author

@sapphi-red sapphi-red added this pull request to the merge queue Jun 27, 2025
Merged via the queue into main with commit 3729c4b Jun 27, 2025
23 checks passed
@sapphi-red sapphi-red deleted the perf/hmr-remove-no-op-runtime-to-commonjs-call branch June 27, 2025 12:16
Boshen pushed a commit that referenced this pull request Jun 30, 2025
## [1.0.0-beta.22] - 2025-06-30

### 🚀 Features

- plugin: use `Log` instead of `BuildDiagnostic` for `PluginContext#log` (#5099) by @shulaoda
- plugin: support info/warn/debug in native plugin context (#5098) by @shulaoda
- plugin: support vite plugin custom in `PluginContext#resolve` (#5097) by @shulaoda
- rolldown_plugin_import_glob: align edge cases with `rolldown-vite` (#5094) by @shulaoda
- rolldown_plugin_vite_resolve: align subpath import resolution (#5093) by @shulaoda
- add commonjs tree shake option (#5096) by @IWANABETHATGUY
- rolldown_plugin_web_worker_post: align with `rolldown-vite` (#5092) by @shulaoda
- manual-chunks: support `getModuleInfo` (#5087) by @hyf0
- advanced-chunks: support `getModuleInfo` in `groups.{group}.name` (#5086) by @hyf0

### 🚜 Refactor

- rolldown_loader_utils: inline unnecessary `binary_to_esm` (#5100) by @shulaoda

### ⚡ Performance

- hmr: remove `console.debug` in `runtime.registerModule` (#5091) by @sapphi-red
- hmr: remove no-op `runtime.__toCommonJS` call (#5089) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- deps: lock file maintenance rust crates (#5105) by @renovate[bot]
- deps: lock file maintenance npm packages (#5104) by @renovate[bot]
- deps: update rust crate schemars to v1 (#5103) by @renovate[bot]
- deps: update dependency vite to v7 (#5102) by @renovate[bot]
- deps: update github-actions (#5101) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.13.12 (#5088) by @renovate[bot]
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.

2 participants