home

Cost Of JavaScript

글 분류
sub
키워드
performance
생성일
2023/08/21 23:59
최근 수정일
2025/01/20 11:29
작성중

⚽️ 목표

목표를 작성
The Cost Of JavaScript - 2023
As we build sites that are more heavily reliant on JavaScript, we sometimes pay for what we send down in ways that we can’t always easily see. In this talk, Addy explains how and why JavaScript is the most expensive resource your site uses today—especially on mobile and lower-end desktops. Web developers should focus on optimizing JavaScript bundles by keeping them small to improve download speeds, especially on mobile devices. Small JavaScript bundles improve network transfer speeds, lower memory usage, and reduce CPU costs.This can be achieved by splitting bundles larger than 50-100 kB. Additionally, it's crucial to enhance execution time by avoiding tasks that overly engage the main thread and by not using large inline scripts over 1 kB. Avoid creating Long Tasks that can keep the main UI thread busy and can push out how soon pages are interactive by users. These steps are vital as parse and compile costs have become faster than before. He will also share tips for fixing JavaScript performance issues so everything loads quicker. A little discipline can help if you want your site to load and be interactive as soon as possible on mobile. A few things that will be covered: - What the dominant costs of heavy JavaScript are - How median hardware plus heavy JavaScript can impact user-experience - Tips and tricks for reducing the cost of JavaScript, reducing long-tasks and improving the Core Web Vitals metrics - Things frameworks and browsers are doing to try reducing the cost of JavaScript by default. - How new performance metrics can help you reason about where to optimize JavaScript to improve user interactions Target Audience: Intermediate web developers Originally presented at Web Unleashed #javascript #webdevelopers #programming #webperformance

TL;DR

짧게 정리해봐

1.

결론

chrome ux report

긴 태스크를 나눠야하는 이유?

FID - First Input Delay

네이티브 인풋마저 로딩이 안되는 부분

느린 네트워크

네트워크의 빠름은 보장되지 않는다 상황, 환경마다 다르다
대역폭이 작을 수 있다. → 요즘 시장에선 대부분 충분하다.(게이밍과 비디오는 제외될 수 있음)
반응 속도가 느릴 수 있음 → 제일 문제될 수 있음
CDN이 좋은 이유는 유저에게 가까운 위치에 존재하기 때문

bundle splitting

TTI를 낮춘다?

Hydration

정적인 HTML 페이지에 상호작용성을 부여하는 행위 - 말그대로 건조한 빵에 수분 공급 해주는 느낌
SSR은 빠른 FCP를 주지만 TTI는 느릴 수 있다.

Partial hydration

Progressive hydration

점진적 하이드레이션, 중요한 부분만 먼저 hydrating 한다

Resumable hydration

React server components

서버에서 그리고 브라우저에 던져준다 끝 - 번들사이즈 0, 자바스크립트 번들이 필요없다.

Streaming Server Rendering

Selective Hydration

Lazy Hydration

참조