Long tasks that block the main thread for 50ms or more cause, among other issues:
- Delayed Time to interactive (TTI).
- High/variable input latency.
- High/variable event handling latency.
- Janky animations and scrolling.
A long task is any uninterrupted period where the main UI thread is busy for 50ms or longer. Common examples include:
- Long-running event handlers.
- Expensive reflows and other re-renders.
- Work the browser does between different turns of the event loop that exceeds 50 ms.
Long tasks refer to "culprit browsing context container", or "the container" for short, which is the top-level page, <object>
that the task occurred within.
For tasks that don't occur within the top-level page and for figuring out which container is responsible for the long task, the TaskAttributionTiming
interface provides the containerId
, containerName
and containerSrc
properties, which may provide more information about the source of the task.
PerformanceLongTaskTiming
inherits from PerformanceEntry
.