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
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
- Tracking bug: https://b.corp.google.com/issues/450309115
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=performance-now-in-audioworkletglobalscope
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+performance.now()%20in%20AudioWorkletGlobalScope
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=performance.now()%20in%20AudioWorkletGlobalScope
- Baseline status: https://webstatus.dev/?q=performance.now()%20in%20AudioWorkletGlobalScope