CKTIS / JavaScript
performance.clearMeasures() — removing User Timing measures
performance.clearMeasures() removes stored User Timing measures from the performance entry buffer. You can remove all measures or every entry with one name without deleting timing marks.
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.clearMeasures();
performance.clearMeasures(measureName);performance.clearMeasures() removes PerformanceMeasure objects, created by performance.measure(), from the performance entry buffer. Without an argument, it removes all measures; performance.clearMeasures(measureName) removes every measure with exactly that name, not just the latest one.
The optional measureName is a DOMString name. If no measures match, the call removes nothing. The return value is always undefined, not the number of deleted entries. The method does not remove PerformanceMark entries; use performance.clearMarks() for those.
Remove your own measures after reading them. In code sharing a page, prefer passing a name over calling without an argument to avoid deleting other modules' measures. The example creates two measures with the same name and checks their count before and after removal without printing variable timing values.
This is a Web API specified by User Timing, not an ECMAScript language feature. The method already appears in User Timing Level 2. Check availability in the target browser, for example with typeof performance.clearMeasures === "function"; Node 24 in a repository does not establish browser support.
Examples
(() => {
const name = "cktis.clearMeasures.demo";
performance.clearMeasures(name);
try {
performance.measure(name);
performance.measure(name);
console.log(performance.getEntriesByName(name, "measure").length);
const result = performance.clearMeasures(name);
console.log(performance.getEntriesByName(name, "measure").length);
console.log(result === undefined);
} finally {
performance.clearMeasures(name);
}
})();Result
2 0 true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.