QuizNot attempted
Long tasks
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Move it to a Web Worker, or split it into chunks that yield (scheduler.yield / setTimeout) between them
- The 400ms of CPU work blocks the main thread wherever it runs, so either move it off the thread (Web Worker) or split it into chunks that yield (
scheduler.yield(),setTimeout) so input and rendering can run in between. - Not wrapping in a Promise: the executor runs synchronously on the main thread.
- Not async: the body still runs synchronously until an await, and the work itself doesn't await.
- Not rAF: runs the whole job just before paint, delaying that frame instead.
- Tasks over 50ms hurt INP.