GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.37k stars 9.37k forks source link

Report perf metrics on soft navigations #14573

Open paulirish opened 1 year ago

paulirish commented 1 year ago

We (and others) have long been interested in making softnavigations more of a first-class experience in Lighthouse. You should be able to know the LCP, FCP, Speed index, etc for that softnav, just like you do for a hard nav.


soft navs are (almost) a thing: https://github.com/WICG/soft-navigations there's several heuristics to be satisfied (either with the new Navigation API or with the older pushState style).. when they're good, blink marks it as a soft nav. There's two intents to expose this concept to the perf timeline.


And there's instrumentation behind all this. It appears as though we may have everything we need to support this in lighthouse! 🎉 This'd definitely improve our timespan story.

so.. we should see trace events for post-softnav LCP candidates.. I see some CLs that suggest FP, FCP are affected as well.

This is behind ~--enable-blink-features=SoftNavigationHeuristics or just the blanket~ "Experimental Web Platform features" .. --enable-experimental-web-platform-features. I successfully saw the "A soft navigation has been detected" console message with the latter flag on https://next-movies-zeta.vercel.app/


In feb 2023 https://chromium-review.googlesource.com/c/chromium/src/+/4230572 landed, adding this: {type: 'largest-contentful-paint', includeSoftNavigationObservations: true}

this might affect trace event emitting in softnav cases.

riddla commented 1 year ago

Does anyone know how one can disable the new "A soft navigation has been detected" console message that is appearing in Chrome (Version 108.0.5359.124)?

connorjclark commented 1 year ago

The only way is to disable Info.

image
adamraine commented 1 year ago

For anyone that's interested, there is https://github.com/adamraine/lighthouse-plugin-soft-navigation which should give FCP and LCP for soft navs using some experimental Chrome features.

SivasubramanianV commented 6 months ago

For anyone that's interested, there is https://github.com/adamraine/lighthouse-plugin-soft-navigation which should give FCP and LCP for soft navs using some experimental Chrome features.

Hi @adamraine , does this still work, i tried but could not see FCP and LCP. Using latest chrome browser. Not canary though. Let me know if my code is correct. Consider commented lines to be not commented for config

20240411_120617.jpg

adamraine commented 6 months ago

@SivasubramanianV please file a bug in https://github.com/adamraine/lighthouse-plugin-soft-navigation