The Performance API is a group of standards used to measure the performance of web applications.
To ensure web applications are fast, it's important to measure and analyze various performance metrics. The Performance API provides important built-in metrics and the ability to add you own measurements to the browser's performance timeline. The performance timeline contains high precision timestamps and can be displayed in developer tools. You can also send its data to analytics end points to record performance metrics over time.
Each performance metric is represented by a single
PerformanceEntry. A performance entry has a
startTime, and a
type. All performance metrics extend the
PerformanceEntry interface and qualify it further.
Most of the performance entries are recorded for you without you having to do anything, and are then accessible either through
Performance.getEntries() or (preferably) through
PerformanceObserver. For example,
PerformanceEventTiming entries are recorded for events that take longer than a set threshold. But the Performance API also enables you to define and record your own custom events, using the
Performance interface is available for each global using
self.performance and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries.
PerformanceObserver interface enables you to listen for various types of performance entry as they are recorded.
A read-only map returned by
performance.eventCountscontaining the number of events which have been dispatched per event type.
Measures the render time of the largest image or text block visible within the viewport, recorded from when the page first begins to load.
Main interface to access performance measurements. Available to window and worker contexts using
Measures rendering timestamps of specific elements.
An entry on the performance timeline encapsulating a single performance metric. All performance metrics inherit from this interface.
Measures latency of events and first input delay (FID).
Detects long tasks that occupy rendering and block other tasks from being executed.
Custom marker for your own entry on the performance timeline.
Custom time measurement between two performance entries.
Measures document navigation events, like how much time it takes to load a document.
Listens for new performance entries as they are recorded in the performance timeline.
List of entries that were observed in a performance observer.
Measures render operations during web page construction.
Measures network loading metrics such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times for resources such as images, scripts, fetch calls, etc.
Surfaces server metrics that are sent with the response in the
Identifies the type of task and the container that is responsible for the long task.
|Element Timing API |
|Event Timing API |
|High Resolution Time |
|Largest Contentful Paint |
|Long Tasks API 1 |
|Navigation Timing Level 2 |
|Paint Timing 1 |
|Performance Timeline |
|Resource Timing |
|Server Timing |
|User Timing |