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(lantern): improve LCP tail error #10529

Merged
merged 11 commits into from
Apr 16, 2020
Merged

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Mar 31, 2020

Summary
This PR makes two key changes to improve our LCP tail error raised in #10527. I've broken the changes into separate commits for easier reviewing and analysis of their accuracy impact.

Ignore offscreen (Low network priority) images in optimistic LCP
This is a pure win. Only metric improvements, no regressions. A no brainer.

Ignore offscreen (Low network priority) image endTimes in the pessimistic LCP, but still consider the network contention they cause
This isn't a pure win since in order to do this we start breaking startTime ties with network priority and it affects other metrics in subtle ways/has a minor regression for SI accuracy, but this is what actually fixes the #10527 netlify case and brings our P95 error in LCP from 127% down to 80% with other massive tail error decreases, so I think it's definitely worth doing.

Here is the summary of total net effect on accuracy.

image

Related Issues/PRs
#10527

@connorjclark
Copy link
Collaborator

AI for me: checkout this branch (or wait til master) and run audits again (use the gathered artifacts you hopefully still have...)

@patrickhulce
Copy link
Collaborator Author

use the gathered artifacts you hopefully still have...

was this directed at me @connorjclark ? do you need some assets I might have lying around?

@connorjclark
Copy link
Collaborator

It was a note to myself

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.

in order to do this we start breaking startTime ties with network priority and it affects other metrics in subtle ways

possible to add a simulator test directly for this? If the effect is subtle on all the metric snapshots then it might be difficult to pin the problem on this if it ever regressed.

@patrickhulce
Copy link
Collaborator Author

possible to add a simulator test directly for this? If the effect is subtle on all the metric snapshots then it might be difficult to pin the problem on this if it ever regressed.

It would still be massive on LCP but ya this is a good call regardless 👍

@vercel vercel bot temporarily deployed to Preview April 13, 2020 20:50 Inactive
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.

I'm curious about a comment you made in one of the syncs about this, being reluctant to bring in other artifacts into lantern analysis (which have so far just needed a trace and a devtools log).

Am I misremembering it and you were talking about another change or did you just find it sufficient to base this on the info in the network records?

*/
static _computeNodeStartPosition(node) {
if (node.type === 'cpu') return node.startTime;
return node.startTime + (PriorityStartTimePenalty[node.record.priority] * 1000 * 1000 || 0);
Copy link
Member

Choose a reason for hiding this comment

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

wait, this seems different than just a tie breaker. It can actually change the order of nodes that don't have the same start time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"tiebreaker" if it were only the exact same nanosecond timestamp is useless. The lower the priority the wider the berth that's given to consider it a "tie" and defer to the higher priority request.

Requests started within the same second that all have their dependencies finished do not really need to be started in the exact same observed order that Chrome happened to request them.

Copy link
Member

Choose a reason for hiding this comment

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

"tiebreaker" if it were only the exact same nanosecond timestamp is useless.

sure, but usually "tie breaker" is for exactly that sort of thing (e.g. sorting comparators). This is more of a time spreading heuristic :)

You didn't post much motivation for the exact numbers used in the PR, and it's not clear to me that reordering like that would work out correctly, but I guess the proof is the comparison errors :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess the proof is the comparison errors

bingo :) haha

and that's fair, so here's my caveat to anyone who comes back trying to find where they came from

Dear reader from the future, I do not have supreme confidence that the exact numbers used in the PR are optimal nor were they divined after some extensive research process. They "felt right" and improved accuracy so if you need to change them for similar reasons, feel free :)

Copy link
Collaborator

@connorjclark connorjclark Mar 31, 2022

Choose a reason for hiding this comment

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

lmao i am future reader, thx for context

*/
static _computeNodeStartPosition(node) {
if (node.type === 'cpu') return node.startTime;
return node.startTime + (PriorityStartTimePenalty[node.record.priority] * 1000 * 1000 || 0);
Copy link
Member

Choose a reason for hiding this comment

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

also that || 0 frightens me :) When does that come into play? startTime and priority should always be defined?

Copy link
Collaborator Author

@patrickhulce patrickhulce Apr 15, 2020

Choose a reason for hiding this comment

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

it shouldn't (it ran successfully on our entire lantern corpus and passed all our tests without this change) but in the event that we get something unplanned for priority the failure mode without it is no longer sorting the nodes at all, failing the entire performance category also seems like a pretty bad experience so 0 fallback makes the most sense.

package.json Outdated Show resolved Hide resolved
@brendankenny
Copy link
Member

did you just find it sufficient to base this on the info in the network records?

maybe it was low priority as proxy for offscreen?

@patrickhulce
Copy link
Collaborator Author

I'm curious about a comment you made in one of the syncs about this, being reluctant to bring in other artifacts into lantern analysis (which have so far just needed a trace and a devtools log).
Am I misremembering it and you were talking about another change or did you just find it sufficient to
base this on the info in the network records?

I was talking about this change :)

For LCP-specifically just using the priority as a proxy like we're doing here is good enough because any image that's onscreen and the largest that would block LCP is not issued with 'Low' priority. We don't really need to distinguish anything more nuanced than that for now.

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.

I can't really evaluate all the snapshot changes but code and error rate changes LGTM!

@brendankenny
Copy link
Member

those are two separate thoughts, so it's more like

I can't really evaluate all the snapshot changes, so I'll trust they're good 🤷 :)
Code and error rate changes LGTM!

Good job finding a fix for this so fast.

@patrickhulce patrickhulce merged commit 6420832 into master Apr 16, 2020
@patrickhulce patrickhulce deleted the lcp_no_offscreen_images branch April 16, 2020 14:28
@connorjclark
Copy link
Collaborator

connorjclark commented Apr 24, 2020

Here's how this changed the numbers from 11ty. I re-used the same artifacts, only difference is the auditing version of Lighthouse.

name url mean mean Δ
performance https://templates.netlify.com/ 75.2 -> 99 23.8
performance https://louisville.aiga.org/awards-show-2019/ 79.4 -> 98 18.6
performance https://www.progressionapp.com/blog/ 70.2 -> 87.8 17.6
performance https://mohitkarekar.com/ 80.8 -> 90.6 9.8
performance https://forte.is/ 78 -> 87.6 9.6
performance https://www.briangershon.com/ 90.2 -> 99.4 9.2
performance https://duncan.dev/ 82.8 -> 91.4 8.6
performance https://fifty.snook.ca/ 90.8 -> 99 8.2
performance https://mochajs.org/ 89.8 -> 98 8.2
performance https://hire.wil.to/ 90.6 -> 98.4 7.8
performance https://usac.ucla.edu/ 83.2 -> 91 7.8
performance https://hamatti.org/ 79.2 -> 86.4 7.2
performance https://www.juanfernandes.uk/ 86 -> 92.2 6.2
performance https://sia.codes/ 90.4 -> 96.4 6
performance https://www.jeremyswinnen.com/ 82.4 -> 88.4 6
performance https://cw2architects.com/ 80.6 -> 86.4 5.8
performance https://www.wisc.edu/ 83.6 -> 89.4 5.8
performance https://2019.nejsconf.com/ 85.8 -> 91.2 5.4
performance https://khanacademyannualreport.org/ 76.8 -> 82 5.2
performance https://www.console.love/ 94.8 -> 100 5.2
performance https://matthewstrom.com/ 92.4 -> 97.4 5
performance https://www.chriscollins.me/ 82.8 -> 87.8 5
performance https://eu-testbook.com/ 77.6 -> 82.2 4.6
performance https://neptunbrigad.hu/ 93.2 -> 97.4 4.2
performance https://www.unabridgedsoftware.com/ 78 -> 81.8 3.8
performance https://shannonethomas.com/ 70.8 -> 74.4 3.6
performance https://yoncetheme.com/ 73.4 -> 77 3.6
performance https://anchorthemes.com/ 69 -> 72 3
performance https://andrewpucci.com/ 82 -> 85 3
performance https://tsuwave.studio/ 83.6 -> 86.6 3
performance https://amorgunov.com/ 90.8 -> 93.6 2.8
performance https://webcomponents.club/ 96.8 -> 99.6 2.8
performance https://eleventy-html5up-txt.appseed.us/ 74.4 -> 76.8 2.4
performance https://zellwk.com/ 80 -> 82.4 2.4
performance https://vincentp.me/ 95.6 -> 97.8 2.2
performance https://genehack.blog/ 95 -> 97 2
performance https://markboulton.co.uk/ 83.8 -> 85.8 2
performance https://www.stjaer.net/ 97.4 -> 99.4 2
performance https://hiber.global/ 64 -> 65.8 1.8
performance https://wiltomakesfood.com/ 90.4 -> 92.2 1.8
performance https://conferences.css-tricks.com/ 97.2 -> 98.8 1.6
performance https://www.andreacorinti.com/ 88.2 -> 89.8 1.6
performance https://www.filamentgroup.com/ 93.2 -> 94.8 1.6
performance https://flatmonthlyfee.co/ 86 -> 87.4 1.4
performance https://www.hawksworx.com/ 98.6 -> 100 1.4
performance https://dassur.ma/ 95.4 -> 96.6 1.2
performance https://developer.chrome.com/devsummit/ 97.6 -> 98.8 1.2
performance https://www.dandevri.es/ 98.2 -> 99.4 1.2
performance https://www.stevenhicks.me/ 88.2 -> 89.4 1.2
performance https://brycewray.com/ 96.6 -> 97.6 1
performance https://cassey-til.glitch.me/ 99 -> 100 1
performance https://practical.guide/ 97 -> 98 1
performance https://web.dev/ 89.4 -> 90.4 1
performance https://quentin.delcourt.be/ 95 -> 95.8 0.8
performance https://tatianamac.com/ 99 -> 99.8 0.8
performance https://www.doesitflip.com/ 99.2 -> 100 0.8
performance https://zoepage.github.io/ 99.2 -> 100 0.8
performance https://11tytips.netlify.com/ 98.8 -> 99.4 0.6
performance https://3lp.me/ 94.6 -> 95.2 0.6
performance https://cathydutton.co.uk/ 96 -> 96.6 0.6
performance https://coastline941.com/ 78.4 -> 79 0.6
performance https://dnhandcrafted.com/ 67.6 -> 68.2 0.6
performance https://eslint.org/ 85 -> 85.6 0.6
performance https://rolandtoth.hu/ 98.4 -> 99 0.6
performance https://shotplot.app/ 96 -> 96.6 0.6
performance https://thedixons.net/ 98.6 -> 99.2 0.6
performance https://toddl.dev/ 98.8 -> 99.4 0.6
performance https://www.coralseacablesystem.com.au/ 85.2 -> 85.8 0.6
performance https://www.duetds.com/ 98 -> 98.6 0.6
performance https://2018.nejsconf.com/ 76.2 -> 76.6 0.4
performance https://alexcarpenter.me/ 99.6 -> 100 0.4
performance https://andrewrico.com/ 81.8 -> 82.2 0.4
performance https://covid19.ca.gov/ 99.2 -> 99.6 0.4
performance https://deuso.de/ 74 -> 74.4 0.4
performance https://github.com/11ty/logo 92.4 -> 92.8 0.4
performance https://mannahfoundation.org/ 74.4 -> 74.8 0.4
performance https://pflry.eu/ 81.6 -> 82 0.4
performance https://www.vtcodecamp.org/ 91 -> 91.4 0.4
performance https://alextheward.com/ 57.8 -> 58 0.2
performance https://crlf.site/ 93.4 -> 93.6 0.2
performance https://edjohnsonwilliams.co.uk/ 96.6 -> 96.8 0.2
performance https://eleventy-step.netlify.com/ 92.8 -> 93 0.2
performance https://frontendnorth.com/ 98.2 -> 98.4 0.2
performance https://kack.dev/ 85.6 -> 85.8 0.2
performance https://nejsconf.com/ 99.6 -> 99.8 0.2
performance https://precious-prana.com/ 98.8 -> 99 0.2
performance https://splitinfinities.com/ 94 -> 94.2 0.2
performance https://unslump.me/ 95.8 -> 96 0.2
performance https://www.barcia.dev/ 99.2 -> 99.4 0.2
performance https://www.kajrietberg.nl/ 98 -> 98.2 0.2
performance https://www.raymondcamden.com/ 74.4 -> 74.6 0.2
performance https://www.signalkuppe.com/ 91.8 -> 92 0.2
performance http://lewicowo.pl/ 100 -> 100 0
performance http://www.guangshi.io/ 94.8 -> 94.8 0
performance https://ajmalafif.design/ 96.8 -> 96.8 0
performance https://alexpage.com.au/ 99.4 -> 99.4 0
performance https://andrewhudson.dev/ 99.2 -> 99.2 0
performance https://annualbeta.com/ 100 -> 100 0
performance https://arpitbatra.netlify.com/ 97.8 -> 97.8 0
performance https://artificial.design/ 81 -> 81 0
performance https://ask.netlify.com/ 99 -> 99 0
performance https://auradix.com/ 0 -> 0 0
performance https://benediktmeurer.de/ 99.8 -> 99.8 0
performance https://bentleydavis.com/ 92.4 -> 92.4 0
performance https://biaskata.com/ 71.8 -> 71.8 0
performance https://biehler-josef.de/ 93.2 -> 93.2 0
performance https://blog.tomayac.com/ 97 -> 97 0
performance https://blr.design/ 100 -> 100 0
performance https://cafeiso.com/ 89.8 -> 89.8 0
performance https://cezaraugusto.net/ 99.4 -> 99.4 0
performance https://christianfei.com/ 91.6 -> 91.6 0
performance https://corina-rudel.de/ 100 -> 100 0
performance https://covidtracking.com/ 98.2 -> 98.2 0
performance https://daffodilpedagogy.com/ 0 -> 0 0
performance https://daslaf.dev/ 98.6 -> 98.6 0
performance https://davepowers.me/ 100 -> 100 0
performance https://debitpay.directory/ 92 -> 92 0
performance https://deletescape.ch/ 99 -> 99 0
performance https://design.saschadiercks.de/ 96.6 -> 96.6 0
performance https://developur.rs/ 99.8 -> 99.8 0
performance https://devreldiaries.commons.host/ 100 -> 100 0
performance https://dgrammatiko.online/ 100 -> 100 0
performance https://docs.shutter.sh/ 97 -> 97 0
performance https://dsmun.in/ 100 -> 100 0
performance https://educationlinks.fyi/ 100 -> 100 0
performance https://eleventy-notist-example.netlify.com/ 100 -> 100 0
performance https://elisted.org/ 99.8 -> 99.8 0
performance https://emergency-site.dev/ 100 -> 100 0
performance https://every-layout.dev/ 80 -> 80 0
performance https://everydayia.com/ 100 -> 100 0
performance https://eystein.no/ 100 -> 100 0
performance https://ffconf.org/ 99.4 -> 99.4 0
performance https://fotis.xyz/ 100 -> 100 0
performance https://gerencialeite.com.br/ 97 -> 97 0
performance https://github.com/PolymerLabs/lit-element-starter-ts 97.2 -> 97.2 0
performance https://glenn.thedixons.net/ 100 -> 100 0
performance https://grochtdreis.de/ 100 -> 100 0
performance https://gvonkoss.com/ 96.8 -> 96.8 0
performance https://hankchizljaw.com/ 99.4 -> 99.4 0
performance https://hans.gerwitz.com/ 98.6 -> 98.6 0
performance https://heydonworks.com/ 100 -> 100 0
performance https://homan.io/ 89.4 -> 89.4 0
performance https://hylia.website/ 98.6 -> 98.6 0
performance https://indiewebguides.org/ 96 -> 96 0
performance https://interviews.shanehudson.net/ 99.8 -> 99.8 0
performance https://ivoputzer.blog/ 98 -> 98 0
performance https://jaenis.ch/ 94.4 -> 94.4 0
performance https://jamesdoc.com/ 83.4 -> 83.4 0
performance https://jamstack-comments.netlify.com/ 100 -> 100 0
performance https://jeffy.info/ 99.8 -> 99.8 0
performance https://jeremenichelli.io/ 100 -> 100 0
performance https://johanbrook.com/ 97 -> 97 0
performance https://joshuakeel.com/ 100 -> 100 0
performance https://kleinfreund.de/ 100 -> 100 0
performance https://kula.blog/ 99.8 -> 99.8 0
performance https://kushagra.dev/ 97.4 -> 97.4 0
performance https://leedsjs.com/ 100 -> 100 0
performance https://lennyanders.dev/ 100 -> 100 0
performance https://levimcg.com/ 99.8 -> 99.8 0
performance https://lilypond-in-markdown.netlify.com/ 98.2 -> 98.2 0
performance https://lookback.io/ 83.6 -> 83.6 0
performance https://lowtus.fr/ 100 -> 100 0
performance https://mangoweb.net/ 100 -> 100 0
performance https://mattrad.uk/ 100 -> 100 0
performance https://mxb.dev/ 100 -> 100 0
performance https://myclientwants.com/ 0 -> 0 0
performance https://nho.io/ 100 -> 100 0
performance https://nicolas-hoizey.com/ 99 -> 99 0
performance https://nuotsu.com/ 98.4 -> 98.4 0
performance https://okitavera.me/ 100 -> 100 0
performance https://paulrobertlloyd.com/ 100 -> 100 0
performance https://pdx.ashur.cab/ 99.8 -> 99.8 0
performance https://personalsit.es/ 100 -> 100 0
performance https://peterthaleikis.com/ 73.4 -> 73.4 0
performance https://piccalil.li/ 100 -> 100 0
performance https://ramigs.dev/ 94.8 -> 94.8 0
performance https://reubenlillie.com/ 100 -> 100 0
performance https://ride.netlify.com/latest 99.2 -> 99.2 0
performance https://rss-jamstack.netlify.com/ 100 -> 100 0
performance https://ryzokuken.js.org/ 99.4 -> 99.4 0
performance https://saschadiercks.de/ 96.2 -> 96.2 0
performance https://screen-read.com/ 100 -> 100 0
performance https://seoslides.page/ 98.6 -> 98.6 0
performance https://serviceindustry.tips/ 100 -> 100 0
performance https://setyourwatchby.netlify.com/ 100 -> 100 0
performance https://sk.listsofbooks.com/ 100 -> 100 0
performance https://slay.sh/ 91.8 -> 91.8 0
performance https://smth.uk/ 99.6 -> 99.6 0
performance https://soldierpackers.com/ 0 -> 0 0
performance https://spirits.bischoff.wtf/ 100 -> 100 0
performance https://statebox.org/ 97.2 -> 97.2 0
performance https://surajjadhav.me/ 100 -> 100 0
performance https://tempertemper.net/ 98.6 -> 98.6 0
performance https://thefutureislikepie.com/ 100 -> 100 0
performance https://thepugautomatic.com/ 99 -> 99 0
performance https://tobiasschmidt.me/ 0 -> 0 0
performance https://treylabs.com/ 100 -> 100 0
performance https://treypiepmeier.com/ 100 -> 100 0
performance https://tto.koser.us/ 79.8 -> 79.8 0
performance https://uglyduck.ca/ 100 -> 100 0
performance https://us-coffee-roasters.com/ 100 -> 100 0
performance https://v5.chriskrycho.com/ 95.2 -> 95.2 0
performance https://webcomponents.dev/ 98.4 -> 98.4 0
performance https://worldwideweb.cern.ch/ 100 -> 100 0
performance https://www.11ty.dev/ 99 -> 99 0
performance https://www.bridgestew.com/ 98.6 -> 98.6 0
performance https://www.bryanlrobinson.com/ 96 -> 96 0
performance https://www.chercheurd.art/ 75.6 -> 75.6 0
performance https://www.cjtype.com/ 72.6 -> 72.6 0
performance https://www.d-hagemeier.com/ 100 -> 100 0
performance https://www.fontspeed.io/ 99.8 -> 99.8 0
performance https://www.ianrose.me/ 77 -> 77 0
performance https://www.joshcrain.io/ 96.6 -> 96.6 0
performance https://www.londoncss.dev/ 100 -> 100 0
performance https://www.pborenstein.com/ 97.8 -> 97.8 0
performance https://www.robinrendle.com/ 98.6 -> 98.6 0
performance https://www.teami.io/ 35.4 -> 35.4 0
performance https://www.timothymiller.dev/ 92.8 -> 92.8 0
performance https://www.undefinednull.com/ 99 -> 99 0
performance https://www.vagabondians.com/ 95.6 -> 95.6 0
performance https://www.webstoemp.com/ 100 -> 100 0
performance https://www.zachleat.com/ 100 -> 100 0
performance https://yatil.net/ 88 -> 88 0
performance https://disjfa.github.io/eleventy-encore/ 93.4 -> 93.2 -0.2
performance https://jdsteinbach.com/ 93 -> 92.8 -0.2
performance https://nothingrandom.com/ 99.4 -> 99.2 -0.2
performance https://v8.dev/ 99 -> 98.8 -0.2
performance https://www.edwardhorsford.com/ 96.2 -> 96 -0.2
performance https://www.matuzo.at/ 98.8 -> 98.6 -0.2
performance https://rowdy.codes/ 80 -> 79.6 -0.4
performance https://www.hairscalpcenter.com/en/ 71.8 -> 71.4 -0.4
performance https://www.contentthread.com/ 58.8 -> 57.8 -1
performance https://www.miriamsuzanne.com/ 94.4 -> 93.4 -1
performance https://www.hamandhoney.com/ 73.4 -> 68.4 -5
performance https://jayantachakraborti.com/ 72.8 -> 67.6 -5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants