angular/angular · warning

Performance API is not supported on this platform

Error message

Performance API is not supported on this platform

What it means

One-time warning from the internal profiler (packages/core/src/profiler.ts): enableProfiling() requires the browser Performance API (performance.mark/measure) to record Angular profiler events. When the platform does not expose it, profiling cannot start; the function logs this warning once (guarded by warningLogged) and returns without enabling. This API is internal and is normally triggered via Angular DevTools, not application code.

Source

Thrown at packages/core/src/profiler.ts:67

    labelName,
    startLabel: `start:${labelName}`,
    endLabel: `end:${labelName}`,
  };
}

let warningLogged = false;
/**
 * This enables an internal performance profiler
 *
 * It should not be imported in application code
 */
export function enableProfiling() {
  if (
    !warningLogged &&
    (typeof performance === 'undefined' || !performance.mark || !performance.measure)
  ) {
    warningLogged = true;
    console.warn('Performance API is not supported on this platform');
    return;
  }

  enablePerfLogging = true;
}
export function disableProfiling() {
  enablePerfLogging = false;
}

View on GitHub (pinned to 51cb07e980)

Solutions

  1. Feature-detect the Performance API before enabling profiling (see validation below)
  2. Run profiling only in a standard browser environment (DevTools attached)
  3. In Node contexts, expose the API first (e.g. import { performance } from 'node:perf_hooks' and set globalThis.performance)
Defensive patterns

Strategy: validation

Validate before calling

// Feature-detect before enabling the profiler (mirrors enableProfiling internals)
const performanceAvailable =
  typeof performance !== 'undefined' &&
  typeof performance.mark === 'function' &&
  typeof performance.measure === 'function';
if (performanceAvailable) {
  enableProfiling();
}

Prevention

When it happens

Trigger: Calling enableProfiling() in an environment where the global performance object is missing or lacks mark/measure: Node/SSR runtimes without perf globals exposed, old browsers, or sandboxed/web-worker contexts; typically Angular DevTools or a debugging bootstrap enabling profiling in such an environment.

Common situations: Debugging with profiler tooling inside Node-based tests or SSR; legacy browsers in a support matrix; environments where performance was polyfilled away or is read-only.

Related errors


AI-assisted analysis of angular/angular@51cb07e980 (2026-08-22). Data as JSON: /api/errors/913a9b2b000091f8. Report an issue: GitHub.