docs.rodeo

MDN Web Docs mirror

Performance APIs

{{DefaultAPISidebar("Performance API")}} {{AvailableInWorkers}} 

The Performance API is a group of standards used to measure the performance of web applications.

Concepts and usage

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 your 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 {{domxref("PerformanceEntry")}} . A performance entry has a name, a duration, 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 {{domxref("Performance.getEntries()")}}  or (preferably) through {{domxref("PerformanceObserver")}} . For example, {{domxref("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 {{domxref("PerformanceMark")}}  and {{domxref("PerformanceMeasure")}}  interfaces.

The main {{domxref("Performance")}}  interface is available in both {{domxref("Window.performance", "Window")}}  and {{domxref("WorkerGlobalScope.performance", "Worker")}}  global scopes, and enables you to add custom performance entries, to clear performance entries, and to retrieve performance entries.

The {{domxref("PerformanceObserver")}}  interface enables you to listen for various types of performance entry as they are recorded.

For more conceptual information, see the Performance API guides below.

UML diagram of Performance APIs

Reference

The following interfaces are present in the Performance API:

Guides

The following guides help you to understand key concepts of the Performance API and provide an overview about its abilities:

Specifications

{{Specifications}} 

See also

In this article

View on MDN