← Back to release summary

performance.now() in AudioWorkletGlobalScope

Category
Performance
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Exposes a WorkletPerformance object on AudioWorkletGlobalScope.performance providing the now() method (DOMHighResTimeStamp). This allows AudioWorkletProcessor scripts running on the real-time audio rendering thread to measure sub-millisecond elapsed time and benchmark DSP or WebAssembly execution using the same monotonic clock and document time origin as Window and Worker contexts, subject to standard cross-origin isolation timer coarsening (5 microseconds when cross-origin isolated, 100 microseconds otherwise).

Motivation

Real-time audio and WebAssembly DSP workloads cannot measure intra-quantum CPU execution time inside AudioWorkletProcessor.process(): currentTime represents sample-frame progression and remains frozen throughout process(), while Date.now() is non-monotonic and coarse. Exposing performance.now() on AudioWorkletGlobalScope via WorkletPerformance (High Resolution Time) provides a monotonic sub-millisecond timestamp anchored to the parent document's time origin, with the same cross-origin isolation coarsening as Window and Worker (5 µs when cross-origin isolated, 100 µs otherwise). This lets audio worklets benchmark per-quantum DSP cost and correlate timestamps directly with window.performance.now()

Standards & signals

Ecosystem

View on chromestatus.com