Web APIs

performance.measure()

Try the free JavaScript compiler

Creates a PerformanceMeasure entry for an interval. Named marks or allowed explicit numeric times can define endpoints.

Formal Syntax & Structure

javascript syntaxjavascript
performance.measure(name, [startMarkOrOptions], [endMark])

Parameters & Attributes

NameTypeDescription
namestringMeasure name.
startMarkOrOptionsstring | PerformanceMeasureOptionsStart mark or options.
endMarkstringEnd mark name.

Return Value

PerformanceMeasure

New interval entry.

Working Example

Example Snippetjavascript
(async () => {performance.mark("v16-a",{startTime:10});performance.mark("v16-b",{startTime:35});const m=performance.measure("v16-span","v16-a","v16-b");console.log(m.startTime,m.duration);performance.clearMarks("v16-a");performance.clearMarks("v16-b");performance.clearMeasures("v16-span");})()
JavaScript Reference