CKTIS / JavaScript
performance.clearMarks() — removing timing marks
performance.clearMarks() removes User Timing marks from the performance entry buffer. Supplying a name removes every matching mark; calling it without an argument removes all marks, but not measures.
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.clearMarks();
performance.clearMarks(markName);performance.clearMarks(markName) removes every PerformanceMark object with the exact supplied name from the performance entry buffer, not just the newest one. An unmatched name changes nothing. The method returns undefined, not a count of removed entries.
performance.clearMarks() without an argument removes all marks. It does not remove PerformanceMeasure entries; use performance.clearMeasures() for those. Prefer clearing by name to avoid deleting marks belonging to other application components.
Create a measure before clearing the marks it references by name. A later performance.measure() using a deleted application mark name throws SyntaxError unless that mark is created again. Existing measures remain in the buffer.
This is a Web API specified by User Timing, not a feature of a particular ECMAScript edition; it already appears in User Timing Level 2. The specification is not a browser compatibility table. Check typeof globalThis.performance?.clearMarks === "function" in the target environment; Node 24 in a repository does not establish browser support.
Examples
(() => {
const name = "cktis:clearMarks:demo";
performance.clearMarks(name);
try {
performance.mark(name);
performance.mark(name);
console.log(performance.getEntriesByName(name, "mark").length);
const result = performance.clearMarks(name);
console.log(performance.getEntriesByName(name, "mark").length);
console.log(result === undefined);
performance.clearMarks(name);
console.log(performance.getEntriesByName(name, "mark").length);
} finally {
performance.clearMarks(name);
}
})();Result
2 0 true 0
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.