-
Notifications
You must be signed in to change notification settings - Fork 38
Clarify addition of PerformanceResourceTiming #146
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
Conversation
We have three outstanding issues related to this logic:
To ensure that we're considering the full picture, could we address these as a single PR? |
Sure sounds good, I'll take a look at the other issues and update this PR. |
Drive-by comments 🚙💨 |
Wait where are the comments? :) By the way I'm not yet sure how to solve issue 141 which is why I haven't updated the PR yet. Maybe I'll add a generic comment saying that the entry should have been added by onload, and this would be accompanied by tests using onload showing that this is currently the case on the major browsers? |
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.
Sorry, forgot to press “submit review” 🙃
index.html
Outdated
named <code>resourcetimingbufferfull</code> at the Document, with | ||
its <code>bubbles</code> attribute initialized to true and with no | ||
default action.</li> | ||
named <code>resourcetimingbufferfull</code> at the <dfn>Performance</dfn> |
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.
seems odd that you are defining Performance here? Did you maybe mean to just link to it?
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
index.html
Outdated
<li>If <a>resource timing buffer current size</a> is greater than | ||
or equal to <a>resource timing buffer size limit</a> and the | ||
<a>resource timing buffer full flag</a> is false, run the following | ||
substeps: | ||
<ol style='list-style-type: lower-latin;' data-link-for= | ||
"Performance"> | ||
<li>Set the <a>resource timing buffer full flag</a> to true.</li> | ||
<li><a data-cite="!DOM/#concept-event-fire">Fire a simple event</a> |
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.
You might want to check the "fire and event" algo, as it changed recently. At the very least, the "simple" is no longer part of the DOM spec, I think.
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.
I removed the word 'simple' because I didn't see it but I also didn't find any recent changes (< 1year) to the fire event algorithm. Is there anything in particular you were thinking about?
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.
Apologies, I was recalling in Payment Request we had to formulate the prose for firing the event in a very particular way, but that's because we defined a new event interface. With just using Event
, I think your current text is all good.
I've added minimal changes to fix the three issues - please take a look. |
index.html
Outdated
"https://github.com/w3c/resource-timing/issues/82">issue 82</a> for | ||
related discussion.</p> | ||
<div class="issue" data-number="82"></div> | ||
<aside class="note">Steps 19 and 20 must be run before the <code> |
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.
This is contrary to the conclusion in #82 (comment).
Let's resolve #141 (comment) before we land this.
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.
Steps 19 and 20 do not involve much work at all and there is no reason for them to not run synchonously. I think what we wanted to delay in Chrome was executing the task in step 6 of https://www.w3.org/TR/performance-timeline-2/#dfn-queue-a-performanceentry
This is actually already spec'd as a low priority task, so Chrome is just trying to actually make it low priority by only running it when idle.
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.
We did not want to encourage use and assumption of entry being available before onload: if the PO entry is delivered asynchronously, we should apply same logic to queuing them into the buffer. Further, if we ever wanted to include processing time of the resource (e.g. #133), locking RT to be queued before onload event would then clash down the road.
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.
I don't see a problem with having a discrepancy between PO callbacks and entries in buffer - the fact that the callback is async is needed for performance reasons, right? And processing time sounds interesting, but I'm not sure how safe it is to delay pushing the entry by a lot, given that the existing implementations seem to add entries to the buffer ASAP. I'm working on tests to see how browsers behave with several types of resources, but if they all have entries by onload, then I would oppose to specing something that is contrary to that. This is a contentious point so I can remove this 'solution' to issue #141 for now but we should make a decision on this sometime.
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.
I'm working on tests to see how browsers behave with several types of resources
Great. If we have this in time, let's review this on the next call. I'd like to get more eyeballs on this before we determine on how to proceed.
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.
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.
True, but that's also rather odd behavior. In this case we're talking about entries available via global timeline, not PerfObserver. You could make the case that we already surface "incomplete" entries via NavTiming, but this just perpetuates the confusion.
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.
From an analytics provider's perspective, incomplete entries (marked as such, with an event indicating mutation or completion) are better than no entries.
Regardless, this seems like something that all current implementations agree on, so changing this behavior in the future wouldn't be harder than it is right now. (and I suspect it's already not web compatible to change it, but could be proven wrong)
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.
Regardless, this seems like something that all current implementations agree on, so changing this behavior in the future wouldn't be harder than it is right now.
Fair enough, I think you have me convinced. Let's get a final ack from wider group on our next call, and we can proceed?
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.
SGTM
@JosephPecoraro @rniwa can you please review this to make sure we've addressed #95, #145. |
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
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.
Let's discuss this in our WG call before merging.
It seems that the logic described in section 4.4 does not prevent from missing RT events:
Algorithm should include saving of current RT entry:
Even simplier way: 1.. If resource timing buffer current size is less than resource timing buffer size limit, run the following substeps: a. Add new entry to the performance entry buffer. And another way: |
That's not what this PR actually says. It actually fixes this by removing the "otherwise" and adding an extra condition instead.
Stepping through this, if the entry we're about to add will reach the buffer's capacity, it will be added (as we'll still pass the "less than" condition), and the counter will be incremented. |
Tim told me that from the discussion in Web Perf WG we would like to land this without the change to require entries to be on the buffer before onload. I didn't quite understand the problem with Safari developer preview, but they said they no longer guarantee entries to be in before onload right @rniwa ? I don't know the reasoning behind this change in Safari but ok. Just want to confirm that I should go ahead and remove the onload part of this PR. |
Yes, in WebKit, we don't |
Which entries would you add? If it's the ones added when the resource timing buffer is full, then I think your interpretation of the spec is not correct because the point of having a limit to the buffer size is to limit the amount of memory we spend on storing entries. If you're storing them even when the resource timing buffer is full, then what's the point of having a limit on the size of the buffer? It should also be noted that that implementation makes Safari inconsistent with other browser vendors: Safari will deliver a different amount of resource timing entries than the rest of browsers, which will ignore entries that occur when the buffer is full. |
Perhaps you misunderstood what I'm saying. What we have is a secondary buffer which is used to queue up entries until
The point is to be compatible with other browsers which don't drop entries on floor when the primary buffer is full.
This is absolutely not true. We deliver exactly the same number of resource timing entires as other browsers. We simply delay the dispatching of |
Ok, that explanation is a bit clearer. I still think it's a bad idea to have very different implementations (although I guess one benefit of this is encouraging developers to use PerformanceObserver instead?). Safari is delaying the resourcetimingbufferfull event and then trying to simulate the entries as if it had been fired as soon as the resource loaded. To me, that's not intuitive at all and may cause subtle bugs. For now, I'll remove the onload change and ask for another review. |
PTAL, reverted onload change. |
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.
Fixes #95
@tdresser
@igrigorik
@marcoscaceres
Preview | Diff