-
Notifications
You must be signed in to change notification settings - Fork 28
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
Timestamps should be specified in an interoperative way #62
Comments
Sounds good to me! Actually I think the order of paint timing call and update the rendering is incorrect. That is, the step "For each fully active Document in docs, update the rendering or user interface of that Document and its browsing context to reflect the current state." would need to go before the paint timing step. And then we can compute the timestamp right there, as there is now a step in between regarding requestIdleCallback which should not affect the computations. I'll need to update the order in HTML for this to work. |
Well, step 10.13 already involves mark painting time so we just need to get rid of this informal note. I don't think we should use step 12.1 since that exposes the precise painting time, which is dangerous for timing attacks. |
You're saying that the timestamp should be the |
I'm not saying that. In step 10.13, updating the rendering invokes mark painting time. I'm saying that we should use the current time at that point. Now, there are a few editorial bugs here. First, mark painting time takes an input timestamp, that's not being passed to the algorithm in the event loop processing model. We need to either specify the timestamp in the event loop processing model, or use the current time in the mark painting time algorithm itself. Second, the event loop processing model says that mark painting time is invoked on each document but the algorithm doesn't take a document as an argument. Once we've fixed it so that mark painting time takes a document as an argument, then we need to refine the definitions of the first paint and the first contentful paint so that those timings are well defined for a given document. Finally, we need to make mark painting time pass this document to reporting paint timing, and the report paint timing algorithm needs to create PerformancePaintTiming object with that document. |
Thanks for pointing out the editorial issues, I also noticed them when going over the steps. Will fix soon. |
Provide the realm when constructing the PerformancePaintTiming object. This way, the queue algorithm will use the correct relevant global object. For #62
Provide the realm when constructing the PerformancePaintTiming object. This way, the queue algorithm will use the correct relevant global object. For #62
No, that text is still in the note:
This note should be removed now that mark the paint timing is now called at the very precise timing in update the reddening step. There is no leeway left for UA to report a best-effort time, and that's a good thing both for security & interoperability. |
Coming back to this issue from 4 years ago, I think I have a proposal that would work for both tihs, #104, and w3c/largest-contentful-paint#104. The idea is that the paint timestamp would be the rAF timestamp of the next frame. So if the rendering opportunity that produces the relevant paint creates some sort of presentation delay, it would be reflected in paint-timing/LCP in an way that's already speified and observable. This would also mitigate anything that has to do with exposing render time of cross-origin images as it's an already exposed timestamp. @smfr @sefeng211 @mmocny @yoavweiss WDYT? |
I like it. Marking timestamps aside, there is also the decision of which rAF to mark. I don't know if we need to clarify further, or if its already specified sufficiently in paint timing, but it should be the rAF frame time of the animation frame that follows after the content was presented. It might only be best-effort or somewhat UA specific, but there are situations (i.e. image decode) where I think a first paint merely requests decode to start, and then there is a future paint (perhaps many rAF's afterwards), that actually paints the decoded image. |
@bdekoz too (see above comment) |
How do you know what the rAF timestamp for the next frame will be? That frame might be delayed. |
We wait to queue the entry and set its timing until that happens, or something like hiding the document happens. |
So if nothing triggers a paint for a while, this would mean that the timestamp can be much delayed, no? I don't think this proposal adds a lot of value over using what Simon proposed, i.e. getting the timestamp at the end of the "update the rendering" steps. In Firefox, waiting for the next frame would add an arbitrary delay to the reported timestamp. The delay would be unrelated to the time when the compositor thread is done processing the current frame: If compositing is slow, then we do the "update the rendering" steps for the next frame before compositing has finished (on a different thread) for the current frame, because we allow compositing to fall behind by up to two frames. And if compositing is fast, but the page isn't triggering any more paints, then the next frame would happen long after compositing finishes for the current frame. I would prefer missing the compositing part entirely over adding an arbitrary delay that is unrelated to the time that compositing takes. |
Summary from WebPerfWG call: the general direction is to align Chromium FCP time with the spec. Chromium still intends to report the current number as |
I like the general idea of exposing both paint timings for easier comparison and better interop. However:
In the past, we discussed exposing both both timings explicitly as new properties:
Then, defining This type of approach already happens for LCP via This would have no breaking change for Chromium, would improve interop, and enable more direct comparison between implementations (where desired). (There was a thread about the above in the past, I guess somewhere else...) |
This is fine with me @smfr how do you feel about this? It basically means that WebKit exposes |
This sounds fine to me from the Firefox side. |
To clarify the proposal in detail, as discussed at WebPerfWG:
|
- `paintTime` (the end of "update the rendering phase") - `presentationTime` (an optional implementation-defined timestamp) `startTime` returns `presentationTime`, or `paintTime` if `presentationTime` is not implemented. Currently this `PaintTimingMixin` is only included in `PerformancePaintTiming`, but it will be included in `ElementTiming`, `LargestContentfulPaint`, `PerformanceEventTiming`, and `PerformanceLongAnimationFrameTiming` as a follow up. This is based on a resolution at the web performance working group. Minutes: https://docs.google.com/document/d/1ZWAUJZBJUvSUyShvKXNEU-cuCe47jpgbR69ckWZUTfI/edit?tab=t.0#heading=h.kb3idfbysfg7 Closes #62
Given w3c/paint-timing#62, we now expose paint timestamps as part of PaintTimingMixin. This PR extends PerformanceElementTiming to include that mixin and propagates the right calls.
Instead of initializing `renderTime`, take it from the paint timing info as propagated from paint timing. See w3c/paint-timing#62 and wicg/element-timing/#81
Let's keep this open for now. I'd love to get confirmation from @smfr that the solution is one he's happy with. |
Sure, sounds good! |
Seems OK. |
Thanks! :) |
Instead of:
the timestamps should be the time at the end of the "update the rendering" steps, namely the same timestamp used for long task reporting, in section 12.1 of https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model
Trying to guess when the OS is going to present the frame is fraught with peril and adds no value.
The text was updated successfully, but these errors were encountered: