-
Notifications
You must be signed in to change notification settings - Fork 427
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
v4 INP attribution ending processingEnd time in the wrong animation frame #462
Comments
I see that, but I also see that DevTools shows the interaction as ending about the same time as the extension says it ends (both of them after paint/commit on the main thread). This makes me think it's not a bug in the web-vitals library but instead a bug somewhere else? I also see that processingDuration ends at the same time as that
The initial PR to add breakdown timings did use Maybe @rviscomi or @tunetheweb could help clarify whether or not any experimental extension versions were release that contained code from #442 before it was merged? |
I’m keeping my PR updated with the latest v4 branch as we merge stuff. Well actually I’ve gone ahead of that now since I have the redirect stuff in there too at the mo. |
(I was using @tunetheweb PR and can try to confirm the version, but I trust that its the latest.)
That rightmost whisker is the "pure presentation delay", off-main thread cost of rasterizing this frame. I do admit that 80ms+ is very atypical for a Mac desktop w/o throttling, but I think this is an example where a hugely complex DOM is causing chrome to go sluggish, which you can see in Raster thread and GPU breakdowns, starting immediately after Commit: I also took a look at this trace in Perfetto and can confirm its that first frame. Not that it matters for web-vitals.js , but to make things more interesting for this example, only about 18ms of the presentation delay is between Commit and Activate, most of the presentation delay comes after Activation. This means that not only is the next paint of content delayed, but all compositor driven animations would be stalled here. However, a reasonable portion of this is caused by DevTools performance profiling (screenshot capture) itself-- which I mention as a warning/reminder that you should disable screenshots if you find presentation delays are very large. I tested the site again, without tracing enabled at all, and still found that scrolling becomes super janky when that details field is being expanded (and still somewhat janky after its expanded). |
Oh, and one more difference with DevTools: the processing end time in DevTools ends with the last event that has an interactionID. That is not what web-vitals.js is doing and I think we should discuss updating DevTools to match, rather than trying to match DevTools. |
Hmm-- in that specific trace I uploaded originally, the second animation frame ends at almost exactly the same time as the first animation frame (only 1ms apart). That is because there is actually no paint update needed and it ends of processingEnd time of the last event handler. This is pure coincidence-- and I re-recorded another trace where the delta is different-- but I wonder if this could be the cause of the error? The event timings would have a renderTime +/- 8ms of each other even through they are in different animation frames and we would group them together, possibly? If we can validate that is it, I think there is a possible remedy:
This also seems like a good reason to change the Event Timing spec to make it explicit that there is no "real renderTime" for some events. |
We definitely do use an 8ms threshold: web-vitals/src/attribution/onINP.ts Lines 98 to 102 in 5420b5f
We do use the LoAF end time to clap the processing time: web-vitals/src/attribution/onINP.ts Lines 217 to 225 in 5420b5f
But given Event timing is only accurate to 8ms, can we assume they will perfectly match up to LoAF entries to allow that removal you suggest? Also if both animation frames end within 1ms of each other then does it really matter in that case that we are reporting the second? Even a max of 8ms seems acceptable for those rare times? |
It's just In cases where you have LoAF, it makes everything easier as you can just use LoAF time range for grouping events by animation frame. But since you don't always have LoAF I think web-vitals.js tried to cluster by event-timing data only and then use loaf only for attribution? |
Correct. Currently we just use LoAF for:
|
Screenshot:
(notice that processing time ends after the paint/commit on main thread).
Note: I was using the experimental PR of Web Vitals Extension to test web-vitals.js v4 beta, but I didn't confirm that it has the latest and greatest version.
Example trace: https://trace.cafe/t/MUVKayAJwm
I think what miught be happening is that we are using the event renderTime as the end point and finding the last LoAF in that range, rather than using the event processing times? I'm not sure.
In order to reproduce here are the steps:
<details>
elementSnippet:
The text was updated successfully, but these errors were encountered: