async function profileGeneratePrimes() {
const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });
genPrimes();
const trace = await profiler.stop();
console.log(trace);
}JS Self-Profiling API / notebook
JS Self-Profiling API
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.