Time keypress to paint by the browser's own measure where it has one

Under a steady stream of keys, the task the page posts after each frame to note
the time can wait behind many later frames: moving between forks on the large
library recorded 400 ms while every key was painted in the next frame (the Event
Timing API put each at 24 ms). Where the browser has measured a key's event to
its next paint, that figure is the sample.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-16 00:37:59 -05:00
1 parent 3298cc430c
commit 1337d73bac
2 files changed
+34 -1

No files matched your search

+1 -1
View File
@@ -497,7 +497,7 @@ export function App() {
store.t0 = null;
requestAnimationFrame(() => {
const ch = new MessageChannel();
ch.port1.onmessage = () => store.samples.push({ what: t.what, ms: performance.now() - t.at });
ch.port1.onmessage = () => store.addSample(t, performance.now() - t.at);
ch.port2.postMessage(0);
});
}