Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

PerformanceEntry.duration — performance entry duration

PerformanceEntry.duration is a read-only property reporting a performance entry's duration in milliseconds. Its meaning depends on entryType; a value of 0 can mean that duration does not apply, rather than that an operation completed instantly.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

entry.duration

Read PerformanceEntry.duration as entry.duration, without calling a method. It returns a DOMHighResTimeStamp: a number expressed in milliseconds that can include a fractional part. This is a duration, not a date or a starting timestamp. The property is read-only.

Its meaning depends on entryType. For measure, it is the length of the measurement; for resource, it is responseEnd - startTime; for navigation, it is loadEventEnd - startTime. For entries such as mark and paint, duration does not apply and is 0. Do not interpret every zero as evidence of fast execution.

Entries are objects of specialized interfaces inheriting from PerformanceEntry. This is a web platform API, not a feature of ECMAScript itself. The property is widely supported in browsers and available in Web Workers, but that does not imply support for every entry type or every variant of the APIs that create entries.

The example creates a PerformanceMeasure with explicit values of start: 10 and end: 35. Reading entry.duration gives 25, regardless of device speed. These are synthetic values, not a measurement of code execution; after reading the result, the example removes the named measurement from the timeline.

Examples

const entry = performance.measure("cktis-duration-demo", {
  start: 10,
  end: 35,
});
console.log(entry.entryType);
console.log(entry.duration);
performance.clearMeasures("cktis-duration-demo");

Result

measure
25

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources