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

Do not deoptimize entire super class when adding a property #4489

Merged
merged 1 commit into from May 7, 2022

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented May 6, 2022

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

We do not want to deoptimize the entire super class when adding a property, it is enough to deoptimize just properties of the given path (actually in a manner of speaking we may not need to deoptimize at all but deoptimization is a more general concept than reassignment and there may be some edge cases we need to cover).

Following a discussion in Twitter https://twitter.com/pschroen/status/1522269915864256512?s=20&t=8igcqT2KuKkLKgGP3hjvVA, see https://rollupjs.org/repl/?version=2.71.1&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmNsYXNzJTIwRm9vJTIwJTdCJTdEJTVDbiU1Q24lMkYlMkYlMjB0cnklMjByZW1vdmluZyUyMHRoaXMlMjBwcm90b3R5cGUlMjBwcm9wZXJ0eSU1Q25Gb28ucHJvdG90eXBlLmJhciUyMCUzRCUyMCU3QiU3RCUzQiU1Q24lNUNuY2xhc3MlMjBCYXIlMjBleHRlbmRzJTIwRm9vJTIwJTdCJTdEJTVDbiU1Q24lMkYlMkYlMjB0cnklMjByZW1vdmluZyUyMHRoaXMlMjBzdGF0aWMlMjBwcm9wZXJ0eSU1Q25CYXIuYmF6JTIwJTNEJTIwJTdCJTdEJTNCJTVDbiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=

@github-actions
Copy link

github-actions bot commented May 6, 2022

Thank you for your contribution! ❤️

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

npm install rollup/rollup#deoptimize-superclass

or load it into the REPL:
https://rollupjs.org/repl/?pr=4489

@codecov
Copy link

codecov bot commented May 6, 2022

Codecov Report

Merging #4489 (f53f23f) into master (19aef13) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4489   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         206      206           
  Lines        7351     7351           
  Branches     2086     2086           
=======================================
  Hits         7257     7257           
  Misses         34       34           
  Partials       60       60           
Impacted Files Coverage Δ
src/ast/nodes/shared/ObjectEntity.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19aef13...f53f23f. Read the comment docs.

@pschroen
Copy link

pschroen commented May 6, 2022

Confirmed to be working locally with rollup/rollup#deoptimize-superclass and my test bundle.

Note the thread originally started with tree-shaking the flat three.module.js bundle with Webpack, and even with this update Rollup is unable to tree-shake the bundle, there are multiple side effects at play here including use of Object.defineProperties outside of the classes (mrdoob/three.js#24006).

I'll leave it up to you if you'd like to close this issue as resolved and we can let you know if anything new comes up?

@lukastaegert
Copy link
Member Author

I think I will just merge this. I might also be able to improve handling of Object.defineProperties in the next days, there is some low-hanging fruit.

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

2 participants