v147 · Performance · Workers

Profile Comparator

Runs an identical CPU-intensive task on both the main thread and a Dedicated Worker, profiling both with the JS Self-Profiling API. Chrome 147 enables the Profiler inside workers — compare the sample traces side by side.

Checking Profiler API support…

Main thread

Ready
Results will appear here

Dedicated Worker

Ready
Results will appear here

enabling the profiler in a worker

// Chrome 147+: Profiler API now works inside a Dedicated Worker
// Requires Document-Policy: js-profiling on the parent document

// worker.js
const profiler = await new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });

// Run CPU-intensive work
doHeavyWork();

const trace = await profiler.stop();

// Send trace to main thread for analysis or upload
postMessage({ type: 'trace', trace });

// Main thread: upload to performance tracing backend
// e.g. https://ui.perfetto.dev

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗