-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -28,15 +30,14 @@ module.exports = [ | |||
score: '<100', | |||
extendedInfo: { | |||
value: { | |||
wastedKb: 14, | |||
wastedKb: 45, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
results
don't have url
s? (needed by computeWasteWithTTIGraph
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but they do? :)
There was a problem hiding this comment.
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}}
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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(...)
ea94556
to
6378f91
Compare
6378f91
to
90f6651
Compare
anything else this is waiting on @brendankenny @paulirish ? |
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. |
Definitely same release (3.0)
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 😆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🏮⚖️
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