New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 9 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Task

Blocked on:
issue 823744

Blocking:
issue 521307



Sign in to add a comment

Ship Event Timing API

Project Member Reported by rbyers@chromium.org, Oct 15 2015 Back to list

Issue description

We're converging on defining some sort of PerformanceTimeline API for developers to get visibility into scroll performance.  In particular, to be aware of any long delays in scrolling caused by blocking on event listeners.

EDIT: doc here https://docs.google.com/document/d/1_jKAyTvMN2xEDmqttozWDIWGfhSwecaDrkHZ0dWkOns/edit#heading=h.fbdd8nwxr7v4.

In particular, we want an API that will give developers visibility into the performance improvements possible by adopting passive event listeners (  issue 489802  ).

igrigorik@ and rbyers@ are working on the spec, miletus@ will work on an implementation.

See   issue 521307   for some discussion of the larger issue here.

 

Comment 1 by rbyers@chromium.org, Oct 15 2015

Blocking: chromium:521307

Comment 2 by rbyers@chromium.org, Oct 15 2015

Labels: Cr-Blink-PerformanceAPIs

Comment 3 by rbyers@chromium.org, Feb 18 2016

Cc: -miletus@chromium.org majidvp@chromium.org tdres...@chromium.org
It's not really clear what we're going to do here - waiting on some sort of generic perf violation reporting strategy (bug?).  

In the meantime, you can more-or-less measure this by using event timestamps (issue 543598) - see http://rbyers.github.io/scroll-latency.html
igrigorik@: Do we consider this a P1 (for current milestone) or should we be lowering the priority for this as it likely won't happen for sometime.
I don't think we have consensus on what this should look like. 

Rick has a couple of prototypes that leverage rAF polling, and I think they're reasonable v1's for us try on some sites.. and they do not require any browser API's. Once we have some experience with these, we can revisit surfacing something in the perf timeline.

Rick, does that sound reasonable?
Cc: panicker@chromium.org
Labels: -Pri-1 Pri-2
Downgrading to P2.

Comment 7 by rbyers@chromium.org, Sep 23 2016

Cc: n...@fb.com
Owner: ----
Status: Available
We talked about this in the webperf meeting at TPAC today.  n8s@ talked about how useful the timestamp-based technique (see http://rbyers.github.io/scroll-latency.html) has been for them, and there was discussion about this being too hard and browser specific.  Eg. in Gecko, some wheel events are cancelable but still don't block scrolling.

So we agreed that someone should propose a concrete API that basically just encapsulates the example in http://rbyers.github.io/scroll-latency.html.  Here's a sketch for one possible idea:

- 'ScriptBlockingScrollTiming' entry in the timeline
- generated for every individual input-driven scroll update
- some way to differentiate "scroll start" from "scroll update" - when it makes sense (this will take some work to figure out, maybe want a third state for unknown, eg. for non-transactional clicky wheel)
- start/duration captures just the time the event spent queued waiting for the main thread, and in executing event handlers.  When all relevant listeners are passive, this will be 0.
- May choose to report this only when duration >50ms - similar to long tasks API (solves the problem of stats like mean or 95th percentile being influenced by the rate of non-blocking events).

Next step is probably for someone (me, tdresser, someone else?) to create a GitHub repo with a little explainer along these lines and run it by the web-perf group.  Any takers?  I think it should be relatively straight forward, and give us a nice pattern to build on for other forms of input latency.
Another (related) idea from TPAC webperf meeting: in Long Tasks API potentially indicate "blocked" input events if the long task actually blocked input. Scroll could be a special case of this.

Cc: igrigo...@chromium.org

Comment 10 by n...@fb.com, Sep 27 2016

Cc: bmau...@fb.com
Labels: DevRel-Facebook

Comment 11 by bmau...@fb.com, Sep 27 2016

Dumb question -- would it make sense to actually log the latency of any event (scroll events included). Basically it seems like this would standardize the interaction logging chrome devtools is doing today (which logs the latency of both scroll events and other things like click). 
Re #8: I think the use cases are a little different.  Long tasks describes things that MAY cause user responsiveness issues (expected responsiveness).  This is talking about precisely describing what the user actually SAW in terms of one type of responsiveness.  They're correlated but I can see use cases for both.  No objection to also having LongTasks indicate events that were blocked by the task, but I think we should do this as well.

One concrete example: it's possible to have many short tasks that together block scrolling, none of which is a long task itself (should be rare in Chrome's scheduler implementation, but not impossible and certainly not guaranteed to be rare across all browsers).

Re #11: It's an interesting question - not stupid at all, but I think it's hard to think of this as "the latency of a scroll event".  "scroll" events indicate that a scroll has occurred, but say nothing of what triggered the scroll.  Eg. say a user drags their finger while JS is running, and after a few ms that JS task changes scrollTop.  A single scroll event will be produced that includes the results of both changes.  How would we define that event's "latency"?

We could certainly expand this to multiple types of input though (related to but not directly associated with input events).  Eg. 'InputBlockingLatency' with some inputtype that can be "scroll", "click" (both mouse, touchscreen tap and enter key), etc.  The trouble there is that the ideal values are so different, you shouldn't really be comparing them.  For scenarios like "click" you've got ~150ms or so to respond without the user feeling like it's slow.  For scroll you've got probably 16-32ms.

Another generic option is to do esprehn's proposal of having an input observer API (similar to IntersectionObserver) that lets you collect batches of input records (including something about their latency) asynchronously after the fact.

All together, from our experience monitoring input metrics in Chrome, I personally think scroll is special and important enough that it makes the most sense to have a scroll-specific API in addition to whatever other general mechanisms we introduce.  But there are lots of other ways this could be spun that I'd be OK with.
Owner: tdres...@chromium.org
Status: Assigned

Comment 14 by n...@fb.com, May 17 2017

Cc: bgir...@fb.com

Comment 15 by bgir...@fb.com, May 17 2017

> Eg. in Gecko, some wheel events are cancelable but still don't block scrolling.

I filed this here https://bugzilla.mozilla.org/show_bug.cgi?id=1356293 . It doesn't appear to be implemented at all.
(100 day update)
This is now covered by the event timing proposal, Tim - could you update the bug?
 
Description: Show this description
Summary: Ship Event Timing API (was: Ship new PerformanceTimeline API for scroll blocking latency)
Labels: migrated-launch-owp Type-Task
This issue has been automatically relabelled type=task because type=launch-owp issues are now officially deprecated. The deprecation is because they were creating confusion about how to get launch approvals, which should be instead done via type=launch issues.

We recommend this issue be used for implementation tracking (for public visibility), but if you already have an issue for that, you may mark this as duplicate.

For more details see here: https://docs.google.com/document/d/1JA6RohjtZQc26bTrGoIE_bSXGXUDQz8vc6G0n_sZJ2o/edit

For any questions, please contact owencm, sshruthi, larforge
This is still on the backlog.

Comment 21 by maxlg@chromium.org, Apr 23 (2 days ago)

Blockedon: 823744
Update: I am actively implementing it - crbug/823744 is tracking the implementation.

Sign in to add a comment