Intent to Ship: Long Task API

464 views
Skip to first unread message

Shubhie Panicker

unread,
Feb 3, 2017, 1:18:00 PM2/3/17
to blink-dev, Ilya Grigorik, Nat Duca

Contact emails

pani...@google.com, igri...@google.com, nd...@google.com


Spec

Spec: https://wicg.github.io/longtasks

Explainer: https://github.com/spanicker/longtasks

Tag review link: https://github.com/w3ctag/spec-reviews/issues/150


Summary

A new performance API to enable applications to measure responsiveness, by detecting presence of “long tasks” that cause contention on the main thread.


Motivation

Responsiveness to user interaction is crucial for users of web apps. Developers need to be able to measure responsiveness to get insight into user experience in the real world.

Users are regularly bogged down by delayed Time to Interactive in page load (a recent study), high / variable input latency on critical interaction events (tap, click, scroll etc), and janky animations or scrolling. These negative experiences turn away users and hurt businesses. Sites that include third party content (ads, social plugins etc.) are frequently the worst offenders.


The major culprit behind these responsiveness issues is main thread contention, which in turn is caused by “long tasks”. Long tasks monopolize the UI thread for extended periods of time and block other critical tasks from being executed - for instance reacting to input.


Some applications and analytics are attempting to measure main thread contention with workarounds. For example, one known pattern is to install a ~short periodic timer and inspect the elapsed time between the successive calls. This has several bad performance implications: preventing quiescence and long idle blocks (see requestIdleCallback); it’s bad for battery life; and there is no way to know what caused the delay, e.g. first party vs third party code.


Long Tasks API addresses these issues, it enables developers to get insight into responsiveness issues,  and provides attribution i.e. insight into who the perpetrators are.


Long Tasks API has a V1 and V2 API version:

- V1 (current version) API provides “minimal frame attribution” i.e. point in the general direction (document frame context) of the problem while following cross-origin rules.

- V2 API will attempt to provide more detailed information (for same origin contexts) such as script URL of long scripts.


Feedback from Developer Partners

We’ve received feedback from developers at Google Ads, SOASTA (Analytics vendor representing major e-commerce sites), YouTube, Facebook. Overall the feedback is positive and they are interested in using the API.

Primary feedback is request for more detailed attribution such as exposing script URL and time in layout, these will be added in the V2 API.


Privacy & Security

See detailed doc here: https://docs.google.com/document/d/1tIMI1gau_q6X5EBnjDNiFS5NWV9cpYJ5KKA7xPd3VB8/edit

Also see evn@’s assessment of the threat model here: https://docs.google.com/document/d/1w7TCMPZ1KtVbi9tuVRfM8d2yLi0Cl3NxNzb8AOgF7bo/edit



Link to “Intent to Implement” blink-dev discussion

https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/intent$20long$20task/blink-dev/A_sM-fu6u50/ao9mnO8SAQAJ



Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Demo link

https://wicg.github.io/longtasks/render-jank-demo.html

https://wicg.github.io/longtasks/demo.html


Debuggability

Long tasks will typically trigger “slow frames” that DevTools marks in red. https://crbug.com/681863 covers surfacing this more clearly in DevTools.


Interoperability and Compatibility Risk

Low.


This is a new API exposed via PerformanceObserver, it is a monitoring use case and does not affect application logic / flow control.

There is interest in this API from other vendors, in particular Microsoft is especially supportive. See TPAC notes and logs for discussion.



OWP launch tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=651926


Entry on the feature dashboard

https://www.chromestatus.com/feature/5738471184400384


Shubhie Panicker

unread,
Feb 3, 2017, 1:40:04 PM2/3/17
to blink-dev, Ilya Grigorik, Nat Duca

Yoav Weiss

unread,
Feb 6, 2017, 6:54:13 AM2/6/17
to Shubhie Panicker, blink-dev, Ilya Grigorik, Nat Duca
Non-owner LGTM! :) I'd be super excited to see that API ship.

A note regarding compatibility: the API can be feature detected, so Web developers can start using it while keeping current hacks they use to measure main thread responsiveness in non-supporting browsers.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Dimitri Glazkov

unread,
Feb 6, 2017, 10:21:56 AM2/6/17
to Yoav Weiss, Shubhie Panicker, blink-dev, Ilya Grigorik, Nat Duca
LGTM1

Philip Jägenstedt

unread,
Feb 7, 2017, 1:32:47 AM2/7/17
to Dimitri Glazkov, Yoav Weiss, Shubhie Panicker, blink-dev, Ilya Grigorik, Nat Duca
LGTM2

https://wicg.github.io/longtasks/ has a very scary warning "Not Ready For Implementation", is that just some generated boilerplate that should be removed?

I poked around in https://github.com/wicg/longtasks/issues a bit and couldn't see anything worth blocking on. Have any other vendors been commenting since TPAC? It doesn't seem like it and it's hard to pay close attention long before planning to implement, but thought I'd ask in case I missed it.

Ilya Grigorik

unread,
Feb 7, 2017, 11:16:44 AM2/7/17
to Philip Jägenstedt, Dimitri Glazkov, Yoav Weiss, Shubhie Panicker, blink-dev, Nat Duca
On Mon, Feb 6, 2017 at 10:32 PM, Philip Jägenstedt <foo...@chromium.org> wrote:
LGTM2

https://wicg.github.io/longtasks/ has a very scary warning "Not Ready For Implementation", is that just some generated boilerplate that should be removed?

I poked around in https://github.com/wicg/longtasks/issues a bit and couldn't see anything worth blocking on. Have any other vendors been commenting since TPAC? It doesn't seem like it and it's hard to pay close attention long before planning to implement, but thought I'd ask in case I missed it.

Yep, we've been periodically reviewing our progress on webperf WG's conf calls.. And received lots of good feedback from Edge and other folks participating in the calls.

ig
 

LGTM1

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Shubhie Panicker

unread,
Feb 7, 2017, 11:27:45 AM2/7/17
to Ilya Grigorik, Philip Jägenstedt, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
On Tue, Feb 7, 2017 at 8:16 AM, Ilya Grigorik <igri...@google.com> wrote:

On Mon, Feb 6, 2017 at 10:32 PM, Philip Jägenstedt <foo...@chromium.org> wrote:
LGTM2

https://wicg.github.io/longtasks/ has a very scary warning "Not Ready For Implementation", is that just some generated boilerplate that should be removed?
Yes this is Bikeshed boilerplate, I'll look into removing it.

Philip Jägenstedt

unread,
Feb 7, 2017, 10:33:48 PM2/7/17
to Shubhie Panicker, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
Thanks, nothing further from me, and still LGTM2.
LGTM1

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Chris Harrelson

unread,
Feb 8, 2017, 12:27:48 PM2/8/17
to Philip Jägenstedt, Shubhie Panicker, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
Hi,

Has the spec been merged into the overall performance timeline API? Is doing so just the next formality?

Thanks,
Chris

LGTM1

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Shubhie Panicker

unread,
Feb 8, 2017, 12:38:53 PM2/8/17
to Chris Harrelson, Philip Jägenstedt, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
Hi Chris,
Could you elaborate:
Do you mean moving the spec off of WICG ? Or is the API question about the API? (or something else?)
If former, then we are in the midst of moving this from WICG to the web perf charter.
If latter, then the API is already implemented in terms of performance timeline API, and available via the Performance Observer.

Chris Harrelson

unread,
Feb 9, 2017, 2:44:11 AM2/9/17
to Philip Jägenstedt, Shubhie Panicker, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
On Wed, Feb 8, 2017 at 9:27 AM, Chris Harrelson <chri...@chromium.org> wrote:
Hi,

Has the spec been merged into the overall performance timeline API? Is doing so just the next formality?

I discussed this question offline with Shubhie and Ilya. The conclusion was that it's intentional that each kind of feature which may end up as a PerformanceEntry in the performance timeline often has its own spec, with references back from the performance timeline spec in the form of a FYI list of valid entry keys.

LGTM3

Philip Jägenstedt

unread,
Apr 7, 2017, 1:43:20 AM4/7/17
to Shubhie Panicker, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca
On Tue, Feb 7, 2017 at 11:27 PM Shubhie Panicker <pani...@google.com> wrote:
On Tue, Feb 7, 2017 at 8:16 AM, Ilya Grigorik <igri...@google.com> wrote:

On Mon, Feb 6, 2017 at 10:32 PM, Philip Jägenstedt <foo...@chromium.org> wrote:
LGTM2

https://wicg.github.io/longtasks/ has a very scary warning "Not Ready For Implementation", is that just some generated boilerplate that should be removed?
Yes this is Bikeshed boilerplate, I'll look into removing it.

This came up on #whatwg today, can you prioritize updating the spec? Thanks!

Shubhie Panicker

unread,
Apr 7, 2017, 12:14:18 PM4/7/17
to Philip Jägenstedt, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca, Philippe Le Hegaret, Tab Atkins, i...@google.com
I've tried updating it. The spec recently moved from WICG to W3C and gh-pages is not available, and we need to set up bikeshed.
Philippe is looking into it I believe. 
Do you have any advise for fixing this issue?
Thanks.

--

Philip Jägenstedt

unread,
Apr 10, 2017, 12:56:44 AM4/10/17
to Shubhie Panicker, Ilya Grigorik, Dimitri Glazkov, Yoav Weiss, blink-dev, Nat Duca, Philippe Le Hegaret, Tab Atkins, i...@google.com
Getting Bikeshed to run automatically shouldn't be a blocker for this, I've synced index.html in https://github.com/w3c/longtasks/pull/23 which should fix the immediate issue.

Anything you can do to make sure what is published at https://w3c.github.io/longtasks/ is always in sync with the master branch would be good, I've wasted a lot of time on cases where things have already been fixed but not published, resulting in much confusion.

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Reply all
Reply to author
Forward
0 new messages