Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The PerformanceLongTaskTiming interface provides information about tasks that occupy the UI thread for 50 milliseconds or more.
Long tasks that block the main thread for 50ms or more cause, among other issues:
A long task is any uninterrupted period where the main UI thread is busy for 50ms or longer. Common examples include:
Long tasks refer to "culprit browsing context container", or "the container" for short, which is the top-level page, <iframe>, <embed> or <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.
PerformanceEntry PerformanceLongTaskTimingThis interface extends the following PerformanceEntry properties for long task timing performance entry types by qualifying them as follows:
PerformanceEntry.duration Read onlyReturns a DOMHighResTimeStamp representing the elapsed time between the start and end of the task, with a 1ms granularity.
PerformanceEntry.entryType Read onlyAlways returns "longtask"
PerformanceEntry.name Read onlyReturns one of the following strings referring to the browsing context or frame that can be attributed to the long task:
Returns a DOMHighResTimeStamp representing the time when the task started.
This interface also supports the following properties:
PerformanceLongTaskTiming.attribution Read onlyReturns a sequence of TaskAttributionTiming instances.
Returns a JSON representation of the PerformanceLongTaskTiming object.
To get long task timing information, create a PerformanceObserver instance and then call its observe() method, passing in "longtask" as the value of the type option. You also need to set buffered to true to get access to long tasks the user agent buffered while constructing the document. The PerformanceObserver object's callback will then be called with a list of PerformanceLongTaskTiming objects which you can analyze.
| Long Tasks API # sec-PerformanceLongTaskTiming |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Oct 8, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.