Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

performance.mark — a named point on the timeline

performance.mark records a named timestamp on the performance timeline. It represents a point, not an interval; options let you set its time and attach metadata.

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

performance.mark(markName)
performance.mark(markName, { startTime, detail })

performance.mark(markName, markOptions) belongs to the User Timing Web API, not ECMAScript. In the Level 3 model it records and returns a PerformanceMark: entryType is "mark" and duration is 0. A separate performance.measure() measures an interval.

Without startTime, it uses performance.now(): milliseconds relative to the local time origin, not a calendar date. Optional detail is copied using structured cloning; do not include secrets, because other scripts on the page can read marks.

Negative startTime throws TypeError; uncloneable detail can cause DataCloneError. In Window, names reserved by the legacy PerformanceTiming, such as navigationStart, cause SyntaxError.

Reusing a name adds an entry rather than replacing the previous one. performance.clearMarks(name) removes all marks with that name. The example requires Level 3 support; Node 24 in the repository does not establish browser support.

Examples

(() => {
  const name = "cktis:performance-mark:demo";
  performance.clearMarks(name);
  try {
    const mark = performance.mark(name, {
      startTime: 12,
      detail: { phase: "ready" }
    });
    console.log(JSON.stringify([
      mark.name,
      mark.entryType,
      mark.startTime,
      mark.duration,
      mark.detail.phase
    ]));
  } finally {
    performance.clearMarks(name);
  }
})();

Result

["cktis:performance-mark:demo","mark",12,0,"ready"]

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