You Didn’t Know About Web Performance in 2025
For years, we’ve been chasing the same ghosts. We compressed our JPEGs, minified our CSS, and obsessed over our Lighthouse scores. Google’s…
You Didn’t Know About Web Performance in 2025

For years, we’ve been chasing the same ghosts. We compressed our JPEGs, minified our CSS, and obsessed over our Lighthouse scores. Google’s Core Web Vitals (CWV) gave us a common language — LCP, FID, CLS — and for a while, that was the game. Get those scores in the green, and you were “fast.”
But it’s 2025. The game has changed.
Having good Core Web Vitals is no longer a competitive advantage; it’s table stakes. The web hasn’t gotten simpler. It’s filled with AI-driven personalization, complex single-page applications, and user expectations that border on telepathic.
The new frontier of web performance isn’t about the initial page load. It’s about what happens after. It’s about fluidity, resilience, and a deep understanding of the browser’s rendering pipeline that goes far beyond what a Lighthouse report can tell you.
This is your guide to that new frontier.
The Silent Killer: A Masterclass in the Rendering Pipeline
We all know the basics: avoid large, render-blocking resources. But the real performance bottleneck on modern, interactive sites is often more insidious. It’s the constant, unnecessary work we force the browser to do after the initial render.
Enter the rendering pipeline:
- JavaScript: Your code makes a change.
- Style: The browser calculates which CSS rules apply to which elements.
- Layout (or “Reflow”): The browser calculates the geometry of the elements — their size and position on the page. This is the most expensive step.
- Paint: The browser fills in the pixels for each element in layers.
- Composite: The browser draws the layers to the screen in the correct order.
The key to elite performance is to avoid triggering the Layout step as much as humanly possible. Every time you force a “reflow,” you’re essentially asking the browser to re-measure and rearrange a piece of your page, a catastrophically slow operation.
The Secret Enemy: Layout Thrashing
What’s worse than a reflow? Dozens of them, back-to-back, in a single frame. This is Layout Thrashing, and your code is probably doing it without you realizing it.
It happens when you alternate between reading a layout property (like element.offsetHeight or getComputedStyle) and writing a layout property (like element.style.height).
The Bad Code (What most of us write):
// A simple example of layout thrashing
function resizeAllMyDivs() {
const divs = document.querySelectorAll('.my-div');
divs.forEach(div => {
const containerWidth = document.querySelector('#container').offsetWidth; // READ
div.style.width = (containerWidth / 2) + 'px'; // WRITE
});
}
// This code reads the container width INSIDE the loop.
// Each iteration forces a new reflow because the browser has to ensure
// the value is up-to-date after the previous write.
The browser can’t batch the changes because you keep asking for a measurement mid-update.
The Pro-Level Fix (Batching Reads & Writes):
// No more thrashing!
function resizeAllMyDivsSmarter() {
const divs = document.querySelectorAll('.my-div');
// 1. READ all values first
const containerWidth = document.querySelector('#container').offsetWidth;
// 2. WRITE all values second
divs.forEach(div => {
div.style.width = (containerWidth / 2) + 'px';
});
}
// We read once, then we write in a loop. The browser can now perform
// one single, efficient reflow at the end.
This is a fundamental shift. Audit your code for read/write loops. The performance gains can be staggering, especially in complex animations or data visualizations.
The Containment Strategy
Another underused superpower is the CSS contain property. It’s a way of telling the browser: “The content inside this element is self-contained. Its changes will not affect the layout of anything outside it.”
.isolated-widget {
/* The browser can heavily optimize rendering for this component */
contain: layout style paint;
/* or the super-powered version for fixed-size elements */
contain: strict;
}
This is a godsend for components like chat widgets, infinite scroll lists, or third-party embeds. The browser can now skip trying to calculate the layout for the entire page when something inside your widget changes.
Metrics for 2025: Welcome to the Post-Load World
Core Web Vitals are a great start, but they primarily measure the loading experience. In 2025, we’re obsessed with the interaction experience.
INP is the New King
Interaction to Next Paint (INP) has replaced FID (First Input Delay) as the core responsiveness metric, and it’s a much tougher boss to beat. While FID only measured the delay of the first interaction, INP measures the worst interaction latency across the entire page visit.
A high INP means your page feels janky and unresponsive. The primary cause? A busy main thread.
The Unsung Heroes: The Scheduler and isInputPending
How do you fight a busy main thread? You learn to yield. For years, we’ve written long-running JavaScript tasks that block the browser from doing anything else, like responding to a user’s click.
Enter the new scheduling primitives. isInputPending() is a simple but revolutionary function. It lets your code ask, “Hey browser, is the user trying to do something right now?”
async function doHeavyWork() {
let workQueue = [...]; // An array of heavy tasks
while (workQueue.length > 0) {
// Before starting a new chunk of work, check if the user is interacting.
if (navigator.scheduling.isInputPending()) {
// User is trying to do something! Let's pause our work.
await new Promise(resolve => setTimeout(resolve, 0));
continue; // Skip to the next loop iteration to re-check.
}
// Do a small chunk of work
const task = workQueue.shift();
process(task);
}
}
This simple check allows you to break up long tasks and yield to the main thread, keeping your UI buttery smooth and your INP score low. For even more control, the new Scheduler API (postTask) lets you run code at different priorities (user-blocking, user-visible, background), giving the browser explicit instructions on what’s important.
The Invisible Drain: Memory Leaks
As SPAs grow more complex, client-side memory usage is the new silent performance killer. A page that starts fast but balloons from 50MB to 500MB of RAM after 10 minutes of use will become slow, janky, and eventually crash.
In 2025, memory profiling is not just for debugging — it’s a core performance practice. A lesser-known API, performance.measureUserAgentSpecificMemory(), allows you to programmatically monitor your app’s memory footprint in production and catch leaks before your users do.
Next-Level Tricks You Haven’t Tried Yet
Ready to go from fast to blazing? These are the techniques that separate the pros from the amateurs.
1. The Speculation Rules API: The Death of the Loading Spinner
Forget prefetch and preload links. The Speculation Rules API is the future of instant navigation. It lets you tell the browser which pages a user is likely to visit next, and the browser will pre-render them entirely in the background. When the user finally clicks the link, the page is already there. The navigation is instantaneous.
You define these rules in a simple <script type=”speculationrules”> tag.
<script type="speculationrules">
{
"prerender": [
{
"source": "document",
"where": {
"and": [
{ "href_matches": "/products/*" },
{ "selector_matches": ".product-link" }
]
},
"eagerness": "moderate"
}
]
}
</script>
This rule tells the browser: “When a user hovers over a link that matches .product-link and points to a /products/ URL, start prerendering that page.” This is a monumental shift for multi-page applications and e-commerce sites.
2. Async Decoding for Images
You’re already using AVIF over WebP (right?). But are you decoding asynchronously? Downloading an image is one thing, but decoding it (turning the compressed data into pixels the browser can display) can still block the main thread, causing jank.
The decoding=”async” attribute on an <img> tag is your friend.
<img src="huge-hero.avif" decoding="async" alt="...">
This tells the browser to perform the heavy lifting of decoding off the main thread. It’s a tiny change with a surprisingly large impact, especially on pages with many large images.
3. Partytown: Your Third-Party Script Quarantine
Third-party scripts (analytics, ads, trackers) are the #1 cause of main-thread congestion. Partytown is a brilliant library that relocates these scripts into a Web Worker, effectively running them in a separate thread. Your main thread is left free to handle user interactions. The third-party scripts can still do their job, but they can’t touch your precious INP score.
4. The Rise of Islands Architecture
The future of front-end isn’t just about components; it’s about Islands. Frameworks like Astro are pioneering this concept. An “island” is an interactive component living on an otherwise static, server-rendered HTML page.
This means you ship zero JavaScript by default. The button, the image carousel, the search bar — they only become interactive (or “hydrate”) when they become visible or the user tries to interact with them. This drastically reduces the Time to Interactive (TTI) and keeps the main thread free.
The Final Shift: Performance as a Design Principle
In 2025, web performance is no longer a task for engineers to handle after the fact. It’s a design principle, a core part of the product development process.
Stop asking “How can we make this faster?” and start asking “How can we architect this to be fast from the beginning?”
This means:
- Performance Budgets are Non-Negotiable: Not just for file size, but for main thread blocking time, INP, and memory usage.
- Design for Interaction Readiness: Use skeleton screens and disabled states that become active only after their logic is loaded. Design UIs that feel responsive even before all the data is present.
- Embrace the Server: With the rise of Server Components in frameworks like Next.js and React, the pendulum is swinging back. Do as much work as possible on the server to send a lighter, faster client.
The web performance landscape is more exciting and complex than ever. The tools are more powerful, the metrics are more user-centric, and the potential for creating truly instantaneous experiences is within our grasp.
Stop chasing scores. Start architecting for speed. Your users will thank you for it.
메타데이터
- post_id
- e45d3595d9bf
- slug
- you-didnt-know-about-web-performance-in-2025-e45d3595d9bf
- url
- https://medium.com/itnext/you-didnt-know-about-web-performance-in-2025-e45d3595d9bf
- canonical_url
- https://medium.com/itnext/you-didnt-know-about-web-performance-in-2025-e45d3595d9bf
- author_url
- https://medium.com/@ace-grid
- status
- ok
- fetched_at
- 2026-06-16 20:05:23