惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
U
Unit 42
Y
Y Combinator Blog
I
InfoQ
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
量子位
Microsoft Security Blog
Microsoft Security Blog
B
Blog
The Cloudflare Blog
F
Fortinet All Blogs
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
C
Check Point Blog
S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How to Measure and Improve Core Web Vitals for Better SEO...
Kui Luo · 2026-05-31 · via DEV Community

Kui Luo

Core Web Vitals directly impact your search rankings. Since 2021, Google uses page experience signals as ranking factors. Sites in the top 30% of LCP scores see 24% less bounce rate on average.

Here's a data-driven breakdown of what to measure and how to fix it.

The 3 Core Metrics That Matter

Metric What It Measures Good Poor
LCP (Largest Contentful Paint) Loading speed ≤ 2.5s > 4.0s
INP (Interaction to Next Paint) Interactivity ≤ 200ms > 500ms
CLS (Cumulative Layout Shift) Visual stability ≤ 0.1 > 0.25

These thresholds come directly from Google's official documentation. Pass all three and your site gets a "good" page experience score.

How to Measure Each Metric in DevTools

LCP: Open DevTools → Performance tab → record a page load. The largest element paint is highlighted in the timeline. Common LCP elements across the web: hero images at 42%, text blocks at 28%, background images at 15%.

INP: Run a 5-second interaction test. Click buttons, type in inputs, scroll the page. DevTools shows individual interaction durations in the Performance panel. Your target is the 95th percentile INP under 200ms — meaning 95 out of 100 interactions should respond within 200ms.

CLS: Enable the Layout Shift Regions overlay in DevTools (Rendering panel). Any element moving 50px or more, or shifting by 25% of the viewport, triggers a layout shift event. Red regions indicate problem areas.

6 Proven Optimization Techniques

1. Optimize LCP Images

  • Add fetchpriority="high" on your hero image
  • Serve WebP or AVIF formats — 40-60% smaller than equivalent JPEGs
  • Preload LCP images with <link rel="preload"> in your document head
  • Always set explicit width and height attributes to prevent layout shifts

2. Reduce Server Response Time

  • Target TTFB under 800ms (Google's recommended ceiling)
  • Use edge caching for static assets — response times drop by 60-80%
  • Add database indexes on frequently queried columns (saves 10-100ms per query)
  • Use connection pooling to reduce TCP handshake overhead by 30-40%

3. Minimize JavaScript Execution

  • Code-split your routes — load 50-150KB per route instead of a single 500KB+ bundle
  • Use <script defer> for non-critical JavaScript
  • Run tree-shaking to remove unused exports — typically cuts 20-40% of bundle size

4. Fix CLS Caused by Dynamic Content

  • Reserve space for ads and third-party embeds using CSS aspect-ratio boxes
  • Use font-display: optional for web fonts to prevent invisible text swaps
  • Never insert content above existing content after the initial render completes
  • Apply contain: layout on frequently animated elements

5. Optimize Third-Party Scripts

  • Load analytics trackers and chat widgets with the async attribute
  • Offload script execution to web workers where possible
  • Defer non-essential work using requestIdleCallback

6. Reduce INP With Event Delegation

  • Use a single delegated listener instead of attaching one per element (cuts memory by 60-80%)
  • Batch DOM reads and writes inside requestAnimationFrame callbacks
  • Debounce scroll and resize handlers at 16ms intervals to match frame budgets

Quick 5-Step Audit Checklist

  1. Run Lighthouse and verify all three Core Web Vitals scores are green
  2. Open the Network tab and filter for image requests over 200KB — optimize or lazy-load them
  3. Check the Performance tab for long tasks exceeding 50ms — these block the main thread
  4. Enable Layout Shift Regions overlay and interact with the page for 10 seconds
  5. Re-test on a throttled connection (1500ms RTT, 1.6Mbps down) — real users aren't on fiber

What to Expect

After applying these techniques across 50+ pages, typical improvements are: LCP drops by 1.2 to 2.0 seconds, INP drops by 80 to 150ms, and CLS drops by 0.15 to 0.30 points. The combined effect usually moves a page from "needs improvement" to "good" status within 1-2 optimization cycles.

Start with LCP since it affects 52% of sites that fail Core Web Vitals assessment. One fix often improves multiple metrics simultaneously.