chunking
Splitting a big job into small pieces that run in separate tasks so the page stays responsive in between.
In more detail
The yield between chunks lets the browser handle input and paint. Process a hundred items, yield, then continue: each chunk stays under the long-task threshold.
Related terms
- long task — A task that keeps the main thread busy for more than 50 milliseconds, long enough for users to notice lag.
- scheduler.yield() — A browser API that pauses a long-running async function so the browser can handle input and rendering, then resumes it with high priority.
Taught in
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform