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

core(byte-efficiency): use lantern for opportunity estimates #4601

Merged
merged 8 commits into from
Mar 12, 2018

Conversation

patrickhulce
Copy link
Collaborator

closes #3618

This moves all byte efficiency audits to use lantern estimates. Render blocking resources and preload opportunities still use bespoke methods, but IMO anything else we do until we surface opportunities by metric would be wasted work anyhow. If others feel differently that it's important to update those too, happy to take a crack at it.

Overall approach: simulate the pessimistic TTCI graph as-is, modify all the resources to have the specified transfer size, re-simulate and report the difference

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

dayum. check out these before and after numbers:

image

That's fantastic. :D

@@ -28,15 +30,14 @@ module.exports = [
score: '<100',
extendedInfo: {
value: {
wastedKb: 14,
wastedKb: 45,
Copy link
Member

Choose a reason for hiding this comment

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

as discussed, can we add more wastedMs values to attempt to catch regressions on our side or Chrome's?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

* @param {!Audit.HeadingsResult} result
* @param {number} networkThroughput
* @return {!AuditResult}
* @param {!Array<{url: string, wastedByte: number}>} results
Copy link
Member

Choose a reason for hiding this comment

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

string to explain method/result?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


const wastedBytes = results.reduce((sum, item) => sum + item.wastedBytes, 0);
const wastedKb = Math.round(wastedBytes / KB_IN_BYTES);
const wastedMs = Math.round(wastedBytes / networkThroughput * 100) * 10;
const wastedMs = this.computeWasteWithTTIGraph(results, graph);
Copy link
Member

Choose a reason for hiding this comment

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

results don't have urls? (needed by computeWasteWithTTIGraph)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but they do? :)

Copy link
Member

Choose a reason for hiding this comment

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

oh, maybe Audit.HeadingsResult needs to be updated? cause right now it looks like it would be
{{results: number, headings: Audit.Headings, passes: boolean, debugString: string=, wastedKb: number, totalKb: number, potentialSavings: string}}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah results is most definitely not a number, that's the array of items with {url: string, wastedBytes: number}

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I also missed that it was result.results.map(...)

@patrickhulce
Copy link
Collaborator Author

anything else this is waiting on @brendankenny @paulirish ?

@paulirish
Copy link
Member

Render blocking resources and preload opportunities still use bespoke methods, but IMO anything else we do until we surface opportunities by metric would be wasted work anyhow. If others feel differently that it's important to update those too, happy to take a crack at it.

I think we should do those as well. I'm fine with it being a separate PR, but I'd like to have our opportunities move to lantern at the same time (ie. same release). Also have a feeling that opps-by-metric will be landing a while from now.

@patrickhulce
Copy link
Collaborator Author

I think we should do those as well. I'm fine with it being a separate PR, but I'd like to have our opportunities move to lantern at the same time (ie. same release).

Definitely same release (3.0)

Also have a feeling that opps-by-metric will be landing a while from now.

Not as confident 😄we've got 4 weeks 'til due date for this and with this PR inflight ~3 weeks that puts me needing to finish it this sprint 😆

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM! 🏮⚖️

@paulirish paulirish merged commit b9e9b55 into master Mar 12, 2018
@paulirish paulirish deleted the lantern_opp_estimates branch March 12, 2018 23:30
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.

Lantern: Improve performance opportunity estimates based on graphs
4 participants