Skip to content

fix: mark knownGlobals global ident and global member access as side effects free#2154

Merged
IWANABETHATGUY merged 3 commits intomainfrom
fix/global
Sep 4, 2024
Merged

fix: mark knownGlobals global ident and global member access as side effects free#2154
IWANABETHATGUY merged 3 commits intomainfrom
fix/global

Conversation

@netlify
Copy link

netlify bot commented Sep 4, 2024

Deploy Preview for rolldown-rs canceled.

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

const Symbol_dispose_remove = Symbol.dispose;
const Symbol_asyncDispose_remove = Symbol.asyncDispose;
console.log(null_keep, undef_keep);

Copy link
Member Author

Choose a reason for hiding this comment

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

// entry.js
using null_keep = null;
await using await_null_keep = null;
using throw_keep = {};
using dispose_keep = { [Symbol.dispose]() {
  console.log("side effect");
} };
await using await_asyncDispose_keep = { [Symbol.asyncDispose]() {
  console.log("side effect");
} };
using undef_keep = void 0;
await using await_undef_keep = void 0;
console.log(
  null_keep,
  undef_keep
);

Still not same as esbuild, but not relevant to this pr, these two stmt is removed either in esbuild snapshot

@IWANABETHATGUY IWANABETHATGUY changed the title Fix/global fix: side effects free detect for global ident and global member expr Sep 4, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2024

Benchmarks Rust

group                                                               pr                                     target
-----                                                               --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol                     1.00     55.5±1.15ms        ? ?/sec    1.00     55.7±0.90ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify              1.00     78.5±1.55ms        ? ?/sec    1.01     79.1±1.22ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-minify-sourcemap    1.00     95.9±2.12ms        ? ?/sec    1.01     96.9±1.61ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap           1.00     64.1±1.38ms        ? ?/sec    1.00     63.9±1.27ms        ? ?/sec
bundle/bundle@rome-ts                                               1.00    103.1±1.06ms        ? ?/sec    1.02    104.9±1.58ms        ? ?/sec
bundle/bundle@rome-ts-minify                                        1.02    198.0±6.31ms        ? ?/sec    1.00    193.2±4.16ms        ? ?/sec
bundle/bundle@rome-ts-minify-sourcemap                              1.03    242.5±5.90ms        ? ?/sec    1.00    235.9±3.78ms        ? ?/sec
bundle/bundle@rome-ts-sourcemap                                     1.01    119.6±1.76ms        ? ?/sec    1.00    118.8±1.85ms        ? ?/sec
bundle/bundle@threejs                                               1.02     34.6±2.87ms        ? ?/sec    1.00     34.0±0.54ms        ? ?/sec
bundle/bundle@threejs-minify                                        1.00     81.6±1.30ms        ? ?/sec    1.00     81.8±2.09ms        ? ?/sec
bundle/bundle@threejs-minify-sourcemap                              1.02    102.8±2.29ms        ? ?/sec    1.00    100.4±2.35ms        ? ?/sec
bundle/bundle@threejs-sourcemap                                     1.01     43.0±0.51ms        ? ?/sec    1.00     42.4±0.44ms        ? ?/sec
bundle/bundle@threejs10x                                            1.02    368.3±3.00ms        ? ?/sec    1.00    361.9±3.50ms        ? ?/sec
bundle/bundle@threejs10x-minify                                     1.00    965.0±7.60ms        ? ?/sec    1.01    976.0±9.93ms        ? ?/sec
bundle/bundle@threejs10x-minify-sourcemap                           1.00  1222.8±12.80ms        ? ?/sec    1.00  1226.3±10.36ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                                  1.00    430.1±4.85ms        ? ?/sec    1.00    428.6±4.32ms        ? ?/sec
remapping/remapping                                                 1.05     33.2±0.51ms        ? ?/sec    1.00     31.7±0.11ms        ? ?/sec
remapping/render-chunk-remapping                                    1.00     83.9±0.38ms        ? ?/sec    1.00     84.3±0.61ms        ? ?/sec
scan/scan@rome-ts                                                   1.01     84.3±1.23ms        ? ?/sec    1.00     83.9±1.59ms        ? ?/sec
scan/scan@threejs                                                   1.01     26.4±0.96ms        ? ?/sec    1.00     26.2±0.27ms        ? ?/sec
scan/scan@threejs10x                                                1.00    260.8±3.55ms        ? ?/sec    1.00    260.4±4.80ms        ? ?/sec

@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review September 4, 2024 13:03
@IWANABETHATGUY IWANABETHATGUY changed the title fix: side effects free detect for global ident and global member expr fix: mark knownGlobals global ident and global member access as side effects free Sep 4, 2024
@IWANABETHATGUY IWANABETHATGUY requested a review from hyf0 September 4, 2024 14:24
@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue Sep 4, 2024
Merged via the queue into main with commit 00ff45d Sep 4, 2024
@IWANABETHATGUY IWANABETHATGUY deleted the fix/global branch September 4, 2024 14:50
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.

2 participants