Breaking up one script took INP from 510ms to 140ms
INP — Interaction to Next Paint — is how quickly a page responds to a tap or click. The enemy is a 'long task': a chunk of work that hogs the browser so it can't react. Think of it like one person monologuing at a meeting while everyone else waits to speak.
A dashboard ran a single analytics function that took 450ms straight through. While it ran, every click felt frozen, so INP hit 510ms.
The fix split that one task into small pieces:
— Broke the loop into chunks of 50 items.
— Yielded control back to the browser between chunks.
— Now clicks could interrupt and get answered.
Result: INP dropped to 140ms.
Try this: in Chrome DevTools Performance tab, look for red-flagged 'Long Tasks'. Each one is a chance to respond faster.
Vitals 101
@CoreVitals101
Breaking up one script took INP from 510ms to 140ms
Этот пост опубликован в Telegram-канале Vitals 101. Подписаться можно по ссылке: @CoreVitals101.