Reduce main-thread blocking, break up long tasks, yield to the browser.
INP optimization
Break long tasks
Any task >50 ms blocks input. Split into chunks with
scheduler.yield()orsetTimeout(..., 0).Defer heavy JS
Third-party analytics, chat widgets, A/B tools — load after interaction, not before.
Optimize event handlers
Debounce/throttle scroll and input. No sync XHR. No forced reflow in click handlers.
Use `content-visibility: auto`
Renders offscreen content lazily, freeing the main thread.
Web Workers for expensive work
Parsing JSON >50ms? Move it off the main thread.