Change:
// we use fibonacci numbers to have a performance baseline that indicates // how slow/fast THIS machine actually is. <del> const sw = new StopWatch(true); let tooSlow = false; function fib(n: number): number { if (tooSlow) { return 0; } if (sw.elapsed() >= 1000) { tooSlow = true; } if (n <= 2) { return n; </del> <ins> const jsSrc = (function computeBaseline(this: WindowOrWorkerGlobalScope) { // the following operation took ~16ms (one frame at 64FPS) to complete on my machine. We derive performance observations // from that. We also bail if that took too long (>1s) let tooSlow = false; function fib(n: number): number { if (tooSlow) { return 0; } if (performance.now() - t1 >= 1000) { tooSlow = true; } if (n <= 2) { return n; } return fib(n - 1) + fib(n - 2); </ins> } <del> return fib(n - 1) + fib(n - 2); } // the following operation took ~16ms (one frame at 64FPS) to complete on my machine. We derive performance observations // from that. We also bail if that took too long (>1s) sw.reset(); fib(24); const value = Math.round(sw.elapsed()); </del> <ins> const t1 = performance.now(); fib(24); const value = Math.round(performance.now() - t1); postMessage({ value: tooSlow ? -1 : value }); }).toString(); const blob = new Blob([`${jsSrc};ncomputeBaseline();`], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const worker = createBlobWorker(blobUrl, { name: 'perfBaseline' }); return new Promise<number>(resolve => { worker.onmessage = e => resolve(e.data.value); </ins> <del> return (tooSlow ? -1 : value); </del> <ins> }).finally(() => { worker.terminate(); URL.revokeObjectURL(blobUrl); }); </ins> }); }

Discussion:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: 1.74.3 OS Version: 22.10 Steps to Reproduce: Vscode Fibonacci numbers are computed, blocking the renderer process for ~130ms ! Maybe the computation of fibonacci numbers could be removed alltogether (preferred) or there could be a setting to disable the computation of fibonacci numbers? The code for computing the fibonacci numbers is here:
I wonder if the baseline could reliably be computed in a worker
We do that to have a baseline performance number that's comparable across machines. It comes far after startup but does compute with other stuff. I like the idea of moving this to a worker but we can also use a lower value. I have chosen 24th because it's one frame (~15ms) on my laptop
Pushed a change to move this into a worker. I have also experimented with some const-time workload, like SHA1 loops for 15ms but got very varying results between 150 and 800 iterations. Sticking to fib for now but it doesn't block the renderer anymore