Navigation Menu

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

Avoid some unnecessary value tracking deoptimizations #3278

Merged
merged 5 commits into from Dec 11, 2019

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

This will slightly improve tree-shaking analysis by avoiding "untracked" values in some situations. Example:

// input
let foo = false;
toggleFoo();
const obj = {};
const unusedObj = foo ? obj : {};

if (obj.someProperty) console.log('should not happen');
else console.log('all fine');

function toggleFoo() {
	foo = true;
}

// old output
const obj = {};

if (obj.someProperty) console.log('should not happen');
else console.log('all fine');

// new output
console.log('all fine');

Probably not much, but every little bit counts, this was the result of reviewing the existing value caching behaviour.

@codecov
Copy link

codecov bot commented Dec 10, 2019

Codecov Report

Merging #3278 into master will increase coverage by 0.35%.
The diff coverage is 98.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3278      +/-   ##
==========================================
+ Coverage   92.76%   93.12%   +0.35%     
==========================================
  Files         170      170              
  Lines        5945     5960      +15     
  Branches     1797     1781      -16     
==========================================
+ Hits         5515     5550      +35     
+ Misses        225      219       -6     
+ Partials      205      191      -14
Impacted Files Coverage Δ
src/ast/nodes/BinaryExpression.ts 97.22% <ø> (ø) ⬆️
src/ast/nodes/Property.ts 92.3% <100%> (+8.67%) ⬆️
src/ast/nodes/LogicalExpression.ts 98.66% <100%> (+2.95%) ⬆️
src/ast/nodes/CallExpression.ts 98.16% <100%> (+2.2%) ⬆️
src/ast/nodes/MemberExpression.ts 98.24% <100%> (+2.63%) ⬆️
src/ast/utils/PathTracker.ts 100% <100%> (ø) ⬆️
src/ast/nodes/IfStatement.ts 100% <100%> (ø) ⬆️
src/ast/nodes/ConditionalExpression.ts 96.05% <100%> (+1.45%) ⬆️
src/ast/nodes/ObjectExpression.ts 91.83% <93.93%> (+4.85%) ⬆️

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 4d809d1...685bc89. Read the comment docs.

@lukastaegert lukastaegert merged commit 31747e3 into master Dec 11, 2019
@lukastaegert lukastaegert deleted the deoptimization-refinements branch December 11, 2019 08:08
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