Millisecond Mafia
Millisecond Mafia
@MillisecondMafia

defer vs async on script tags

defer vs async on script tags
Both unblock the parser. Execution timing differs and it matters.

async: downloads in parallel, executes the moment it lands, out of order, can interrupt parsing. Good for independent tags (analytics).

defer: downloads in parallel, executes after HTML parse, in order. Good for app code with dependencies.

Mistake: async on your main bundle. It fires mid-parse, blocks the main thread, INP spikes ~+120ms during load.
Use defer for ordered app JS, async only for fire-and-forget.
Takeaway: defer protects parse + order; async risks +100ms INP on app code.
Этот пост опубликован в Telegram-канале Millisecond Mafia. Подписаться можно по ссылке: @MillisecondMafia.
tech

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

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

start

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

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

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