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

Split up converter.rs into AST nodes #5510

Merged
merged 3 commits into from May 17, 2024
Merged

Conversation

lukastaegert
Copy link
Member

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

Initially, the Rust side of the AST converter was mostly a single file, converter.rs, spanning several thousand lines of code. My goal, however, is to structure the Rust side similarly to the TypeScript side by co-location AST node related code.
This PR will create a separate Rust file for each (ESTree) AST node as with Rust, it is possible to split up the AstConverter implementation over as many files as we like. In the future, related tree-shaking and rendering logic can be placed within the same files, making it easy to see the lifetime of an AST node in one place.

Copy link

vercel bot commented May 6, 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 May 7, 2024 4:46am

Copy link

github-actions bot commented May 6, 2024

Thank you for your contribution! ❤️

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

npm install rollup/rollup#split-up-converter

Notice: Ensure you have installed Rust nightly. If you haven't installed it yet, please first see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust, then see https://rust-lang.github.io/rustup/concepts/channels.html to learn how to install Rust nightly.

or load it into the REPL:
https://rollup-3e608qgok-rollup-js.vercel.app/repl/?pr=5510

Copy link

github-actions bot commented May 6, 2024

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.174 ± 0.046 9.130 9.222 1.00
node _benchmark/current/bin/rollup -i ./perf/entry.js -o _benchmark/result/current.js 9.200 ± 0.048 9.149 9.244 1.00 ± 0.01

Internal benchmark

  • BUILD: 8116ms, 752 MB
    • initialize: 0ms, 26.1 MB
    • generate module graph: 3103ms, 575 MB
      • generate ast: 1480ms, 568 MB
    • sort and bind modules: 448ms, 618 MB
    • mark included statements: 4557ms, 752 MB
      • treeshaking pass 1: 1527ms, 718 MB
      • treeshaking pass 2: 731ms, 742 MB
      • treeshaking pass 3: 291ms, 745 MB
      • treeshaking pass 4: 271ms, 745 MB
      • treeshaking pass 5: 315ms, 751 MB
      • treeshaking pass 6: 261ms, 749 MB
      • treeshaking pass 7: 244ms, 752 MB
      • treeshaking pass 8: 238ms, 753 MB
      • treeshaking pass 9: 218ms, 754 MB
      • treeshaking pass 10: 222ms, 752 MB
      • treeshaking pass 11: 217ms, 752 MB
  • GENERATE: 875ms, 1.02 GB
    • initialize render: 0ms, 914 MB
    • generate chunks: 80ms, 926 MB
      • optimize chunks: 0ms, 920 MB
    • render chunks: 778ms, 1 GB (+2%)
    • transform chunks: 16ms, 1.02 GB
    • generate bundle: 0ms, 1.02 GB

Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.81%. Comparing base (00f0681) to head (b3d39d6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5510   +/-   ##
=======================================
  Coverage   98.81%   98.81%           
=======================================
  Files         238      238           
  Lines        9540     9540           
  Branches     2437     2437           
=======================================
  Hits         9427     9427           
  Misses         48       48           
  Partials       65       65           

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

If an unwrapper only calls methods from a single
AST node, it is placed in the same file
@lukastaegert lukastaegert merged commit a25a779 into master May 17, 2024
39 checks passed
@lukastaegert lukastaegert deleted the split-up-converter branch May 17, 2024 04:56
Copy link

This PR has been released as part of rollup@4.18.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.

None yet

1 participant