2026?,Web????"????"???"????"???Google?????,?????????1?,?????20%;???????????????3?,?2026???????????????1?????????,Google??Core Web Vitals??????????--????????????,???????????????
??????????Web???????,?Core Web Vitals???????????????,????????????????,????2026?????????
?:????????????
Core Web Vitals?Google?2020????????????,??????,2026?????????????????PageSpeed Insights??,Core Web Vitals??????????,????????????:??Core Web Vitals,?????????????????
??????????:
| ?? | ?? | ???? | ???? |
|---|---|---|---|
| LCP | Largest Contentful Paint | ???????? | ?2.5? |
| INP | Interaction to Next Paint | ?????? | ?200ms |
| CLS | Cumulative Layout Shift | ????? | ?0.1 |
LCP?Core Web Vitals???????,???????????(????????????)??????2026?,Google?LCP?"??"??????2.5??
??LCP?(>2.5?)?????:
LCP???????:
???:?????????(TTFB)
TTFB(Time To First Byte)?LCP?????????:?600ms???????:??CDN???????????????(?Redis)?????????????????TTFB?1200ms???450ms,LCP??????37%?
???:??LCP????
?????LCP??(??????????????),?????:
???:??????
// ??:?????LCP??
<link rel="preload" as="image"
href="/images/hero.webp"
fetchpriority="high">
// ??:CSS????
<link rel="stylesheet" href="non-critical.css"
media="print" onload="this.media='all'">
INP?2024???FID(First Input Delay)????,??????????(????????)???????????INP??????????,?????????????????,????????
INP???:
INP = ???? + ???? + ????
??INP??????????:
??????:
// ??:??requestIdleCallback???????
function processAnalytics() {
requestIdleCallback(() => {
// ????????????
sendAnalyticsData();
}, { timeout: 2000 });
}
// ??:????,????
function processLargeArray(items) {
const CHUNK_SIZE = 100;
let index = 0;
function processChunk() {
const chunk = items.slice(index, index + CHUNK_SIZE);
chunk.forEach(processItem);
index += CHUNK_SIZE;
if (index < items.length) {
// ?????,?????
setTimeout(processChunk, 0);
}
}
processChunk();
}
?????(Long Tasks):
?????????50ms?????"???",?INP????????Chrome DevTools?Performance?????????,?????5ms???????
CLS??????????????????????2026?????CLS????--???????????????,???????????????,??????????
??CLS?????:
??CLS?????:
// 1. ?????/??????
<img src="hero.jpg" width="800" height="400" alt="...">
// 2. ??aspect-ratio??
.hero-image {
width: 100%;
aspect-ratio: 16 / 9;
background-color: #f0f0f0; /* ??? */
}
// 3. ??????
@font-face {
font-family: 'MyFont';
src: url('/fonts/MyFont.woff2') format('woff2');
font-display: swap; /* ??FOIT */
}
// 4. ?????
.ad-slot {
min-height: 250px; /* ?????? */
}
?????????????,???????LCP???????2026????????:
????????:
???????:
<picture>
<source
type="image/avif"
srcset="hero-400.avif 400w,
hero-800.avif 800w,
hero-1200.avif 1200w"
sizes="(max-width: 600px) 100vw, 50vw">
<source
type="image/webp"
srcset="hero-400.webp 400w,
hero-800.webp 800w,
hero-1200.webp 1200w"
sizes="(max-width: 600px) 100vw, 50vw">
<img
src="hero-800.jpg"
alt="Hero image"
width="800"
height="400"
loading="lazy"
decoding="async">
</picture>
????(LCP??)????loading="lazy":
<!-- ??LCP??:??eager??,??? --> <link rel="preload" as="image" href="/images/hero.webp" fetchpriority="high"> <img src="/images/hero.webp" fetchpriority="high" loading="eager"> <!-- ?????:??lazy?? --> <img src="/images/below-fold.webp" loading="lazy" decoding="async">
JavaScript???Web??????????????:
????????:
// ???????????
const handleLogin = async () => {
const { showLoginModal } = await import('./login-modal.js');
showLoginModal();
};
// React???????
const HeavyComponent = React.lazy(() => import('./HeavyComponent'));
// Vue??????
const AsyncComponent = defineAsyncComponent(() =>
import('./AsyncComponent.vue')
);
Tree Shaking?????:
????????(Vite?Webpack 5?Rspack)?Tree Shaking??,?????????????Terser?esbuild??????????
???????: