Skip to content

Comments

fix: remove redundant code in export * from 'external' for esm format#1974

Merged
IWANABETHATGUY merged 9 commits intomainfrom
fix/redundant-external-runtime-for-esm
Aug 14, 2024
Merged

fix: remove redundant code in export * from 'external' for esm format#1974
IWANABETHATGUY merged 9 commits intomainfrom
fix/redundant-external-runtime-for-esm

Conversation

@IWANABETHATGUY
Copy link
Member

@IWANABETHATGUY IWANABETHATGUY commented Aug 13, 2024

Description

Closed #1940

@netlify
Copy link

netlify bot commented Aug 13, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit b1a4826
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/66bc6d8109835d0008303780

let re_export_fn_name = self.canonical_name_for_runtime("__reExport");
let importer_namespace_name =
self.canonical_name_for(self.ctx.module.namespace_object_ref);
let importee_namespace_name = self.canonical_name_for(rec.namespace_ref);
Copy link
Member

@hyf0 hyf0 Aug 13, 2024

Choose a reason for hiding this comment

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

You could get this in EcmaModule#star_exports , no need to collect them here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tweak a little, but I still can't find a way to get rec.namespace_ref without get rec

@github-actions
Copy link
Contributor

github-actions bot commented Aug 13, 2024

Benchmarks Rust

  • target: main(cc41c94)
  • pr: fix/redundant-external-runtime-for-esm(b1a4826)
group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.00     51.0±0.62ms        ? ?/sec    1.00     50.9±0.50ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.05     77.1±0.90ms        ? ?/sec    1.00     73.8±0.87ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.04     94.1±1.30ms        ? ?/sec    1.00     90.7±0.72ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.01     59.5±0.57ms        ? ?/sec    1.00     58.7±0.44ms        ? ?/sec
bundle/bundle@rome-ts                                               1.00    100.8±0.86ms        ? ?/sec    1.01    101.4±1.06ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.01    184.4±1.95ms        ? ?/sec    1.00    183.5±3.90ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.00    224.2±1.78ms        ? ?/sec    1.00    223.6±3.87ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.01    117.6±1.22ms        ? ?/sec    1.00    116.8±0.87ms        ? ?/sec
bundle/bundle@threejs                                               1.01     36.2±1.61ms        ? ?/sec    1.00     35.9±0.16ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.00     83.5±2.69ms        ? ?/sec    1.01     84.4±1.06ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.00     99.7±0.95ms        ? ?/sec    1.00    100.0±1.48ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.01     45.9±0.99ms        ? ?/sec    1.00     45.3±0.98ms        ? ?/sec
bundle/bundle@threejs10x                                            1.00    381.9±1.92ms        ? ?/sec    1.03    393.2±1.73ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.00    983.3±8.73ms        ? ?/sec    1.00    980.7±6.33ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.00  1224.8±11.76ms        ? ?/sec    1.00  1226.5±10.47ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.00    458.7±2.35ms        ? ?/sec    1.01    461.3±3.34ms        ? ?/sec
remapping/remapping                                                 1.00     32.7±0.12ms        ? ?/sec    1.01     33.1±0.33ms        ? ?/sec
remapping/render-chunk-remapping                                    1.00     78.2±0.37ms        ? ?/sec    1.04     81.0±0.36ms        ? ?/sec
scan/scan@rome-ts                                                   1.00     80.7±0.34ms        ? ?/sec    1.00     81.0±0.62ms        ? ?/sec
scan/scan@threejs                                                   1.00     28.5±0.69ms        ? ?/sec    1.00     28.6±1.03ms        ? ?/sec
scan/scan@threejs10x                                                1.00    288.5±2.41ms        ? ?/sec    1.01    290.4±1.85ms        ? ?/sec

@IWANABETHATGUY
Copy link
Member Author

what the heck about the benchmark?

@IWANABETHATGUY
Copy link
Member Author

what the heck about the benchmark?

looks like just noise

@IWANABETHATGUY IWANABETHATGUY changed the title Fix/redundant external runtime for esm fix: remove redundant code in export * from 'external' for esm format Aug 14, 2024
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review August 14, 2024 07:43
Comment on lines +287 to +292
if cjs_format {
stmt_info.referenced_symbols.push(importer.namespace_object_ref.into());
stmt_info
.referenced_symbols
.push(self.runtime.resolve_symbol("__reExport").into());
}
Copy link
Member Author

Choose a reason for hiding this comment

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

for esm we on-demand reference importer.namespace_object_ref

@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Aug 14, 2024
Merged via the queue into main with commit 2eb06ef Aug 14, 2024
@IWANABETHATGUY IWANABETHATGUY deleted the fix/redundant-external-runtime-for-esm branch August 14, 2024 09:09
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.

[Bug]: esm export * from 'externalized-dep' still generating unnecessary code

2 participants