v147 · developer trial · workers · perf
js-profiling in dedicated workers
The JS Self-Profiling API — sample-based, low-overhead CPU attribution — now works inside Dedicated Workers. Sites can finally measure where their worker time is going, gated by Document Policy as on the main thread.
concepts
-
Worker Profile
Spins up a Dedicated Worker that does some real CPU work, profiles it for ~2 seconds, then renders the captured frames as a hot-functions list.
-
Trace upload
Worker A runs the load and profiles it. Worker B aggregates the trace off the main thread into a compact payload, then
navigator.sendBeaconfires it at a telemetry endpoint — the WICG-recommended pattern for RUM profiling at scale. -
Profile Comparator
Runs an identical CPU-intensive task (prime factorisation) on both the main thread and a Dedicated Worker and profiles both with the JS Profiler API. Chrome 147 enables the Profiler inside workers — compare the sample traces and timings side by side.
-
Profiler API Explorer
Three-tab explorer. Main thread tab: configurable sample interval and buffer size, runs Fibonacci or sort workload, renders trace as a horizontal flame-graph. Worker tab: detects
Profilerinside a Blob Worker and posts the trace back. Comparison tab: overlays main vs worker samples per function in a paired-bar chart. -
Compatibility Lab
Detects the
ProfilerAPI on both main thread and inside aWorker. Runs a live profiler test in a blob worker and reports sample counts. Provides theperformance.mark()fallback and the complete worker-messaging pattern for environments withoutDocument-Policy: js-profiling.
why it shipped
Lots of work has moved off the main thread — image processing, parsing, AI inference, codecs. But the JS Self-Profiling API was main-thread-only, so the moment something interesting moved into a worker, sites lost the ability to attribute time. The fix is to apply the same Profiler primitive inside dedicated workers, gated by the same js-profiling Document Policy. Performance teams now get a complete picture of where execution time lands.
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗