Performance
The Performance interface provides access to performance-related information for the current page.
Performance entries are specific to each execution context. You can access performance information for code running in a window via Window.performance, and for code running in a worker via WorkerGlobalScope.performance.
EventTarget Performance
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 6 | 12 | 7 | 8 | 18 | 9 | |
| The performance property of the Window interface returns a Performance object, which can be used to gather performance information about code running in the window's scope. | 6 | 12 | 7 | 8 | 18 | 9 |
| The clearMarks() method removes all or specific PerformanceMark objects from the browser's performance timeline. | 29 | 12 | 38 | 11 | 29 | 11 |
| The clearMeasures() method removes all or specific PerformanceMeasure objects from the browser's performance timeline. | 29 | 12 | 38 | 11 | 29 | 11 |
| The getEntries() method returns an array of all PerformanceEntry objects currently present in the performance timeline. | 28 | 12 | 35 | 11 | 28 | 11 |
| The getEntriesByName() method returns an array of PerformanceEntry objects currently present in the performance timeline with the given name and type. | 28 | 12 | 35 | 11 | 28 | 11 |
| The getEntriesByType() method returns an array of PerformanceEntry objects currently present in the performance timeline for a given type. | 28 | 12 | 35 | 11 | 28 | 11 |
| The mark() method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline. | 28 | 12 | 38 | 11 | 28 | 11 |
mark (markOptions parameter) `markOptions` parameter | 78 | 79 | 101 | 14.1 | 78 | 14.5 |
mark (returns performancemark) Returns `PerformanceMark` | 78 | 79 | 101 | 14.1 | 78 | 14.5 |
| The measure() method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline. | 28 | 12 | 38 | 11 | 28 | 11 |
measure (measureOptions parameter) `measureOptions` parameter | 77 | 79 | 103 | 14.1 | 77 | 14.5 |
measure (returns performancemeasure) Returns `PerformanceMeasure` | 78 | 79 | 103 | 14.1 | 78 | 14.5 |
| The performance.now() method returns a high resolution timestamp in milliseconds. It represents the time elapsed since Performance.timeOrigin (the time when navigation has started in window contexts, or the time when the worker is run in Worker and ServiceWorker contexts). | 24 | 12 | 15 | 8 | 25 | 9 |
| The timeOrigin read-only property of the Performance interface returns the high resolution timestamp that is used as the baseline for performance-related timestamps. | 62 | 16 | 53 | 15 | 62 | 15 |
| The toJSON() method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object. | 56 | 12 | 25 | 14.1 | 56 | 14.5 |
worker_support Available in workers | 30 | 14 | 34 | 11 | 30 | 11 |
| The PerformanceEntry object encapsulates a single performance metric that is part of the browser's performance timeline. | 46 | 12 | 35 | 11 | 46 | 11 |
| The read-only duration property returns a DOMHighResTimeStamp that is the duration of the PerformanceEntry. The meaning of this property depends on the value of this entry's PerformanceEntry.entryType. | 28 | 12 | 35 | 11 | 28 | 11 |
| The read-only entryType property returns a string representing the type of performance metric that this entry represents. | 28 | 12 | 35 | 11 | 28 | 11 |
| The read-only name property of the PerformanceEntry interface is a string representing the name for a performance entry. It acts as an identifier, but it does not have to be unique. The value depends on the subclass. | 28 | 12 | 35 | 11 | 28 | 11 |
| The read-only startTime property returns the first DOMHighResTimeStamp recorded for this PerformanceEntry. The meaning of this property depends on the value of this entry's PerformanceEntry.entryType. | 28 | 12 | 35 | 11 | 28 | 11 |
| The toJSON() method is a Serialization; it returns a JSON representation of the PerformanceEntry object. | 45 | 16 | 35 | 11 | 45 | 11 |
worker_support Available in workers | 62 | 15 | 60 | 11 | 62 | 11 |
| PerformanceMark is an interface for PerformanceEntry objects with an PerformanceEntry.entryType of "mark". | 28 | 12 | 38 | 11 | 28 | 11 |
| The read-only detail property returns arbitrary metadata that was included in the mark upon construction (either when using Performance.mark or the PerformanceMark.PerformanceMark constructor). | 78 | 79 | 101 | 14.1 | 78 | 14.5 |
| The PerformanceMark() constructor creates a DOMHighResTimeStamp with the given name. | 76 | 79 | 101 | 14.1 | 76 | 14.5 |
| PerformanceMeasure is an abstract interface for PerformanceEntry objects with an PerformanceEntry.entryType of "measure". Entries of this type are created by calling Performance.measure to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. | 25 | 12 | 38 | 11 | 25 | 11 |
| The read-only detail property returns arbitrary metadata that was included in the mark upon construction (when using Performance.measure. | 78 | 79 | 103 | 14.1 | 78 | 14.5 |
| The PerformanceObserver interface is used to observe performance measurement events and be notified of new PerformanceEntry as they are recorded in the browser's performance timeline. | 52 | 79 | 57 | 11 | 52 | 11 |
| The disconnect() method of the PerformanceObserver interface is used to stop the performance observer from receiving any PerformanceEntry events. | 52 | 79 | 57 | 11 | 52 | 11 |
| The observe() method of the PerformanceObserver interface is used to specify the set of performance entry types to observe. | 52 | 79 | 57 | 11 | 52 | 11 |
| The PerformanceObserver() constructor creates a new PerformanceObserver object with the given observer callback. The observer callback is invoked when PerformanceEntry are recorded for the PerformanceEntry.entryType that have been registered, via the PerformanceObserver.observe method. | 52 | 79 | 57 | 11 | 52 | 11 |
PerformanceObserver (droppedEntriesCount) Experimental `droppedEntriesCount()` parameter | 95 | 95 | | | 95 | |
| The static supportedEntryTypes read-only property of the PerformanceObserver interface returns an array of the PerformanceEntry.entryType values supported by the user agent. | 73 | 79 | 68 | 13 | 73 | 13 |
| The takeRecords() method of the PerformanceObserver interface returns the current list of PerformanceEntry objects stored in the performance observer, emptying it out. | 65 | 79 | 60 | 15 | 65 | 15 |
worker_support Available in workers | 62 | 79 | 57 | 11 | 62 | 11 |
| The PerformanceObserverEntryList interface is a list of PerformanceEntry that were explicitly observed via the PerformanceObserver.observe method. | 52 | 79 | 57 | 11 | 52 | 11 |
| The getEntries() method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects. The list's members are determined by the set of PerformanceEntry.entryType specified in the call to the PerformanceObserver.observe method. The list is available in the observer's callback function (as the first parameter in… | 52 | 79 | 57 | 11 | 52 | 11 |
| The getEntriesByName() method of the PerformanceObserverEntryList interface returns a list of explicitly observed PerformanceEntry objects for a given PerformanceEntry.name and PerformanceEntry.entryType. The list's members are determined by the set of PerformanceEntry.entryType specified in the call to the PerformanceObserver.observe method. The list is… | 52 | 79 | 57 | 11 | 52 | 11 |
| The getEntriesByType() method of the PerformanceObserverEntryList returns a list of explicitly observed PerformanceEntry objects for a given PerformanceEntry.entryType. The list's members are determined by the set of PerformanceEntry.entryType specified in the call to the PerformanceObserver.observe method. The list is available in the observer's callback… | 52 | 79 | 57 | 11 | 52 | 11 |
| Other | ||||||
| The HTTP Timing-Allow-Origin response header specifies origins that are allowed to see values of attributes retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions. | 54 | 79 | 45 | 11 | 54 | 11 |
- This feature was removed in a later browser version (29)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (29)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (29)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (29)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (36)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (28)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (28)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (28)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (28)
- Available with a vendor prefix: webkit (25)
- This feature was removed in a later browser version (24)
- Available with a vendor prefix: webkit (21)
- In Firefox 57.0.4 the accuracy was reduced to 20 microseconds.
- In Firefox 59 the accuracy was reduced to 2 milliseconds.
- In Firefox 60 the accuracy was increased to 1 millisecond.
- Available with a vendor prefix: webkit (25)
- Available with a vendor prefix: webkit (25)
Use cases
-
Using Performance
The Performance interface provides access to performance-related information for the current page.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.