The goals
๐ช๐ปWhat is "Performance"?
โ๐ปMeasuring & Analyzing Performance
๐๐ปOptimization Ideas
๐๐ปFurther Resources
insertAdjacentElement
jsperf
์ด ๊ฐ์ ์น์ ์์๋ JavaScript ์ฑ๋ฅ์ ๋ํด ๋ฐฐ์ ์ต๋๋ค.
์น ์ฌ์ดํธ์ ์ ๋ฐ์ ์ธ ์ฑ๋ฅ์ด ์ค์ํ ๊ฒ์ JavaScript๋ง์ด ์๋๋๋ค. ๋ค๋ฅธ ํด๋ผ์ด์ธํธ ์ธก ์ต์ ํ(์: CSS, ์ด๋ฏธ์ง => ์ฐธ์กฐ: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency) ์ธ์๋ ์๋ฒ ์ธก ์ฑ๋ฅ์ ๊ฐ์ ์ํฌ ์ ์์ต๋๋ค.
์๋ฒ ์ธก(์: NodeJS)์์ ์ฝ๋๋ฅผ ์คํํ๋ ๊ฒ๋ ์ค์ํ์ง๋ง ์๋ฒ ๊ตฌ์ฑ๋ ์ค์ํฉ๋๋ค.
ํนํ ๋ค์๊ณผ ๊ฐ์ ์ธ ๊ฐ์ง ์ฃผ์ ๊ฐ์ ์์ญ์ ์ดํด๋ณผ ์ ์์ต๋๋ค.
- ์ ๊ณต๋ ์์ฐ์ ์์ถ
- ์บ์ฑ(ํด๋ผ์ด์ธํธ ์ธก ๋ฐ ์๋ฒ ์ธก)
- HTTP/2
์์ถ
์์ถ์ ์ ์ ์์ฐ(CSS, JS, ์ด๋ฏธ์ง)์ ์ ๊ณตํ๊ธฐ ์ ์ ์์ถํ๋ ๊ฒ๋๋ค. ์ต์ ๋ธ๋ผ์ฐ์ ๋ ์ด๋ฌํ ํ์ผ์ ์์ถ์ ํธ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์๊ณ ์๋์ผ๋ก ์์ถ์ ํ๋๋ค. ์์ถ๋ ์์ฐ์ด ์ ์ก๋๊ธฐ ๋๋ฌธ์ ์๋ฒ์์ ํด๋ผ์ด์ธํธ๋ก ์ ์ก๋๋ ๋ฐ์ดํฐ๊ฐ ๋ ์ ์ด์ง๋๋ค => ๋ก๋ฉ ์๊ฐ์ด ๋ ๋นจ๋ผ์ง๋๋ค.
์์ถ์ ์ค์ ํ๋ ๋ฐฉ๋ฒ์ ์ฌ์ฉ ์ค์ธ ์๋ฒ/์๋น์ค์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. ๊ฐ๋ น Firebase์์ ์ ์ ์์ฐ์ ์๋์ผ๋ก ์์ถ๋ฉ๋๋ค.
์์ฒด NodeJS ์๋ฒ ์ธก ์ฝ๋๊ฐ ์๋ ๊ฒฝ์ฐ ์ ์ ์์ฐ์ด ์์ถ๋์๋์ง ์๋์ผ๋ก ํ์ธํด์ผ ํฉ๋๋ค(https://github.com/expressjs/compression).
์บ์ฑ
์บ์ฑ์ ๋ณต์กํ ์ฃผ์ ์ ๋๋ค - ์ฌ์ฌ์ฉํ ์ ์๋๋ก ๋ฐ์ดํฐ๋ ํ์ผ์ ์ ์ฅํ๋ ๊ฒ์ด๊ณ , ๋ค์ํ ์์ค์์ ์ํํ ์ ์์ต๋๋ค.
์๋ฅผ ๋ค์ด ๋ธ๋ผ์ฐ์ ๋ ์ ๊ณต ํธ์คํธ(https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)์์ ์ค์ ํ ์บ์ฑ ํค๋๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์๋์ผ๋ก ํ์ผ(์: JS ํ์ผ)์ ์บ์ํฉ๋๋ค. ๋ฐ๋ผ์ ์๋ฒ ์ธก ๊ตฌ์ฑ์์ ์ด๋ฌํ ํค๋๋ฅผ ์ ์ดํ๋ฉด ๋ธ๋ผ์ฐ์ ๊ฐ ์ด๋ฌํ ํ์ผ์ ์บ์ํ๋ ๋ฐฉ๋ฒ์ ์ ์ดํ ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ถํ์ํ ๋ฐ์ดํฐ ์ ์ก์ ํผํ ์ ์์ง๋ง ์ฌ์ดํธ ๋ฐฉ๋ฌธ์๊ฐ ์ค์ํ ์ ๋ฐ์ดํธ๋ฅผ ๋์น์ง๋ ์๋๋ก ํด์ผ ํฉ๋๋ค.
์๋ฒ ์ธก ์บ์ฑ์ ๋์ผํ ๋ฐ์ดํฐ๋ฅผ ์์ฒญํ๋ ์ฌ๋ฌ ์์ฒญ์ด ์บ์๋ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ฌ ์ ์๋๋ก ์๋ฒ์์ ์์ ํ๋ ๋ฐ์ดํฐ(์: ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ๊ฐ์ ธ์จ ๋ฐ์ดํฐ)๋ฅผ ์ ์ฅํ๋ ๊ฒ๋๋ค.
์ด ๋งํฌ์์ ์บ์ฑ์ ๋ํด ๋ ์์ธํ ์์๋ณผ ์ ์์ต๋๋ค. https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
์ด ๋งํฌ์์๋์. https://wp-rocket.me/blog/different-types-of-caching/
HTTP/2
HTTP/2๋ Http ํ๋กํ ์ฝ์ ์ต์ "ํ์"์ด๊ณ HTTP 1๊ณผ๋ ๋ฌ๋ฆฌ "์๋ฒ ํธ์"๋ฅผ ํ์ฉํฉ๋๋ค. ์ด๋ ์๋ฒ๊ฐ (ํด๋ผ์ด์ธํธ๊ฐ ์์ฒญํ๊ธฐ๋ฅผ ๊ธฐ๋ค๋ฆฌ๋ ๋์ ) ํ์ํ ์์ฐ/ํ์ผ์ ํด๋ผ์ด์ธํธ์ ๋ฅ๋์ ์ผ๋ก ํธ์ํ ์ ์์์ ์๋ฏธํฉ๋๋ค.
๋ ์์ธํ ์ค๋ช ์ ์ด ๋งํฌ์์ ํ์ธํด ์ฃผ์ธ์. https://developers.google.com/web/fundamentals/performance/http2
Sources
https://web.dev/optimize-javascript-execution/
Optimize JavaScript execution
JavaScript often triggers visual changes. Sometimes that's directly through style manipulations, and sometimes it's calculations that result in visual changes, like searching or sorting data. Badly-timed or long-running JavaScript is a common cause of perf
web.dev
https://developer.chrome.com/docs/devtools/
Chrome DevTools - Chrome Developers
Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser.
developer.chrome.com
https://github.com/jsperf/jsperf.com
GitHub - jsperf/jsperf.com: jsperf.com v2. https://github.com/h5bp/lazyweb-requests/issues/174
jsperf.com v2. https://github.com/h5bp/lazyweb-requests/issues/174 - GitHub - jsperf/jsperf.com: jsperf.com v2. https://github.com/h5bp/lazyweb-requests/issues/174
github.com
https://www.breck-mckye.com/blog/2014/08/using-jsperf-a-how-to-guide/
Using jsPerf: a how-to guide
If you’re interested in testing the performance of a particular piece of JavaScript, you might be interested in jsPerf. jsPerf allows you to run and compare the speed of arbitrary snippets of JavaScript against a blob of HTML of your choice. This means y
www.breck-mckye.com