Vitals 101
Vitals 101
@CoreVitals101

One listener instead of 200 took INP from 290ms to 110ms

One listener instead of 200 took INP from 290ms to 110ms

INP — Interaction to Next Paint — measures click responsiveness. A hidden cost: attaching a separate click-listener to hundreds of items. Each one uses memory and slows the page's reaction. Think of it like giving every guest their own doorbell instead of one for the house.

A table with 200 rows attached a click handler to every row, so clicks lagged and INP sat at 290ms.

The fix was 'event delegation' — one listener on the parent that figures out which row was clicked:

— Removed 200 individual listeners.
— Added 1 listener on the table container.
— It reads which row fired the click and acts on it.

Result: INP dropped to 110ms, and the page used less memory too.

Try this: if you attach listeners in a loop, one parent listener often does the same job faster.
Этот пост опубликован в Telegram-канале Vitals 101. Подписаться можно по ссылке: @CoreVitals101.
tech

Свежие посты в категории «Tech Infrastructure»

Все каналы категории →

start

Готовы запустить рекламу через сеть public.tg?

Новый оффер, продукт, GEO, кейс, событие или партнёрский запуск — соберём маршрут под задачу и отдадим медиаплан.

Telegram для медиаплана: @AFFtop_connect. Быстрый тест: $20 за канал, $1000 за пакет по сети.