Skip to content

When tree-shaking logical expression, make sure to remove all trailing white-space.#5581

Merged
lukastaegert merged 1 commit intomasterfrom
gh-5578-improve-logical-expression-tree-shaking
Jul 20, 2024
Merged

When tree-shaking logical expression, make sure to remove all trailing white-space.#5581
lukastaegert merged 1 commit intomasterfrom
gh-5578-improve-logical-expression-tree-shaking

Conversation

@lukastaegert
Copy link
Copy Markdown
Member

This should hopefully also improve sourcemaps.

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

This remove all trailing white-space when the right side of a logical expression is removed, which hopefully should also improve source maps.

…g white-space.

This should hopefully also improve sourcemaps.
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2024 2:19pm

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 19, 2024

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#gh-5578-improve-logical-expression-tree-shaking

Notice: Ensure you have installed the latest stable Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust.

or load it into the REPL:
https://rollup-om242n8st-rollup-js.vercel.app/repl/?pr=5581

@github-actions
Copy link
Copy Markdown

Performance report!

Rough benchmark

Command Mean [s] Min [s] Max [s] Relative
node _benchmark/previous/bin/rollup -i ./perf/entry.js -o _benchmark/result/previous.js 9.161 ± 0.037 9.135 9.204 1.00 ± 0.00
node _benchmark/current/bin/rollup -i ./perf/entry.js -o _benchmark/result/current.js 9.157 ± 0.009 9.147 9.165 1.00

Internal benchmark

  • BUILD: 8111ms, 750 MB
    • initialize: 0ms, 26 MB
    • generate module graph: 3129ms, 574 MB
      • generate ast: 1515ms, 567 MB
    • sort and bind modules: 450ms, 617 MB
    • mark included statements: 4538ms, 750 MB
      • treeshaking pass 1: 1536ms, 716 MB
      • treeshaking pass 2: 742ms, 742 MB
      • treeshaking pass 3: 290ms, 745 MB
      • treeshaking pass 4: 271ms, 748 MB
      • treeshaking pass 5: 311ms, 749 MB
      • treeshaking pass 6: 257ms, 750 MB
      • treeshaking pass 7: 240ms, 753 MB
      • treeshaking pass 8: 233ms, 751 MB
      • treeshaking pass 9: 214ms, 755 MB
      • treeshaking pass 10: 216ms, 752 MB
      • treeshaking pass 11: 213ms, 750 MB
  • GENERATE: 885ms, 1.02 GB
    • initialize render: 0ms, 914 MB
    • generate chunks: 89ms, 917 MB
      • optimize chunks: 0ms, 917 MB
    • render chunks: 772ms, 1 GB
    • transform chunks: 21ms, 1.02 GB
    • generate bundle: 0ms, 1.02 GB

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.04%. Comparing base (a9a6108) to head (610233b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5581   +/-   ##
=======================================
  Coverage   99.04%   99.04%           
=======================================
  Files         238      238           
  Lines        9256     9256           
  Branches     2441     2441           
=======================================
  Hits         9168     9168           
  Misses         58       58           
  Partials       30       30           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukastaegert lukastaegert merged commit 1d2c1e9 into master Jul 20, 2024
@lukastaegert lukastaegert deleted the gh-5578-improve-logical-expression-tree-shaking branch July 20, 2024 04:49
@github-actions
Copy link
Copy Markdown

This PR has been released as part of rollup@4.19.0. You can test it via npm install rollup.

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.

[Treeshaking] Dead branches of OR logical expressions leave a mapped empty space in the bundle

1 participant