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

推荐订阅源

D
Docker
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
罗磊的独立博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
IT之家
IT之家
博客园 - 聂微东
Spread Privacy
Spread Privacy
V2EX - 技术
V2EX - 技术
S
Security Affairs
宝玉的分享
宝玉的分享
V
V2EX
C
Cisco Blogs
博客园 - Franky
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
S
Securelist
J
Java Code Geeks
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
WordPress大学
WordPress大学
W
WeLiveSecurity
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志

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 Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
The will-change Tax: How a 600 kB Transform Hint Cost Me 5 MB
Olexandr Uvarov · 2026-06-01 · via DEV Community

I open DevTools → Layers on our landing page. Sort by memory. First in the list — a text section. 680×1491. 4.1 MB.

I check the block's CSS. No will-change. No transform. No filter. No position: fixed. Just position: relative, display: flex, a white background.

Then I open Compositing Reasons:

Overlaps other composited content.

That's the trail. Something below this block promoted itself onto a GPU layer, and our innocent wrapper got dragged along by z-order rules.

In my previous article I covered the mechanics of implicit compositing: element B becomes a layer → element A above it in z-order has to become a layer too. Basic compositor physics.

But in code reviews, in PRs, in conversations with the team, I keep seeing the same hole in mental models. This article is about that hole.

What people miss

will-change reads like a local hint. Put it on an element — that element becomes a layer. End of story.

The mental model looks like this:

[ figure: will-change: transform ]   → becomes a layer
[ wrapper next to it ]               → untouched, fine

Enter fullscreen mode Exit fullscreen mode

Reality looks like this:

[ figure: will-change: transform ]   → becomes a layer (trigger)
[ wrapper next to it ]               → ALSO a layer (overlap victim)

Enter fullscreen mode Exit fullscreen mode

will-change affects more than the component you put it on. It affects everything that sits above it in z-order and physically overlaps with it.

And that leads to the part nobody talks about.

The cost is paid by the victim, not the trigger

Here are the numbers from my case:

Element Size Memory Reason
figure.parallax (trigger) 400×400 640 kB will-change: transform
figure.parallax (trigger) 380×380 578 kB will-change: transform
.text_section_wrapper (victim) 680×1491 4.1 MB Overlaps other composited content

Two small parallax effects cost 1.2 MB combined — that's a budget I took knowingly.

The 4.1 MB wrapper, I did not take. Overlap took it. Total: 5.3 MB of GPU memory for two images that drift slightly on scroll.

The texture memory formula:

width × height × DPR² × 4 bytes

Enter fullscreen mode Exit fullscreen mode

Memory scales quadratically with dimensions. Small trigger × big victim = big bill. And the bill is not visible in the trigger's CSS — it shows up only in DevTools → Layers, in the Memory estimate of the neighbor.

Direction matters

Overlap is one-directional in z-order. Composited layers paint bottom-up: everything that sits above the trigger gets promoted; everything below is fine.

Practical debugging trick: when you see "Overlaps other composited content," look down the DOM and z-stack to find the trigger, not up. The trigger sits below you in paint order.

Who actually set will-change

It was not in my CSS. Grep said no. The <figure> component said no.

Then I opened the Elements panel — and there it was. style="will-change: transform", inline. Set by a library — a popular parallax package we use in the project.

I dug into its source. The shape was something like this:

// inside the library
class ParallaxElement {
  constructor(options) {
    this.el = options.el;
    // ...
    this.el.style.willChange = 'transform';
  }
}

Enter fullscreen mode Exit fullscreen mode

In the constructor. The moment the instance is created. Unconditionally. No IntersectionObserver. No visibility check. Once set, the hint stays until the element unmounts.

This is not unique to one library. Parallax packages, reveal-on-scroll animations, sticky-effect helpers, intersection-based UI kits — many of them set will-change inline at initialization and never remove it. From the library author's perspective it is a reasonable optimization: they don't know when the user will scroll to your element, so they promote the layer ahead of time.

With one parallax image, you won't notice. With dozens of sections (as we have across our landing pages), it is tens of megabytes of GPU memory. And every one of them drags its biggest neighbor into compositing through overlap.

This is not a bug in any specific library. It's a pattern category worth checking for in any third-party animation library you pull in.

What to do

will-change is a short-term hint. The spec is explicit:

Authors should switch off will-change when the element stops being actively changed.

Wrong:

.figure {
  will-change: transform; /* forever */
}

Enter fullscreen mode Exit fullscreen mode

Memory is allocated from CSS parse until page unload. Even when the element is far below the viewport.

Right:

const io = new IntersectionObserver(
  ([entry]) => {
    entry.target.style.willChange = entry.isIntersecting ? 'transform' : 'auto';
  },
  { rootMargin: '200px' }
);
io.observe(figure);

Enter fullscreen mode Exit fullscreen mode

Element enters the viewport — hint turns on. Scroll past — hint turns off, layer collapses, victim stops being a layer. rootMargin: '200px' prewarms the layer a bit before the element enters so the first animated frame doesn't jank on layer creation.

One caveat if the offending will-change was injected by a third-party library: this only works if the library sets the hint once (most do — in the constructor) and never re-asserts it on scroll. If it re-asserts, you're racing the library, and the fix is to either fork it or skip ahead to the scroll-timeline approach below.

Better still — in 2026 this works in Chrome, Edge, and Safari 26:

@keyframes parallax {
  from { translate: 0 30px; }
  to   { translate: 0 -30px; }
}

.figure {
  animation-name: parallax;
  animation-timing-function: linear;
  animation-timeline: view();
}

Enter fullscreen mode Exit fullscreen mode

A note on translate instead of transform: translateY(...): the individual transform properties (translate, rotate, scale) have shipped everywhere since 2022 and ride the exact same compositor fast-path as the transform shorthand. Same performance, less typing, no risk of clobbering an existing transform on the element from a sibling rule.

Two footguns worth calling out. First, the animation shorthand resets animation-timeline back to auto, so if you do use it, the shorthand has to come before animation-timeline: view(). Second, Firefox refuses to play a scroll-driven animation without an explicit animation-duration — Chrome and Safari infer the full timeline range, Firefox does not. The longhand form above sidesteps both.

This is not a time-based animation. With animation-timeline: view(), animation progress is bound to the element's position in the scrollport — not to wall-clock time. The element does not move on its own. It moves only when you scroll, and the browser recomputes the translate on every frame from the current scroll position.

The boundaries are precise. view() 0% is the moment the subject's leading edge first crosses into the scrollport — when an element scrolling up from below first touches the viewport's bottom edge. view() 100% is the moment the trailing edge last leaves — when the element's bottom touches the viewport's top edge. The full scroll window during which the animation runs is therefore viewport height + element height pixels.

Between those two points, the translate is a continuous linear function of scroll position:

progress = (currentScrollY  scrollAtEntry) / (viewportHeight + elementHeight)
y        = 30px + (60px) × progress         // applied as `translate: 0 <y>`

Enter fullscreen mode Exit fullscreen mode

So for a 400 px tall image in an 800 px viewport with speed: 3:

Scroll position progress translate
element top just touches viewport bottom 0.00 0 30px
element half way through viewport 0.50 0 0
element bottom just leaves viewport top 1.00 0 −30px

Stop scrolling — the value freezes at the current progress. Scroll back — it reverses smoothly. This is exactly how a JS parallax library updates transform on every scroll event. The math is identical. The only difference: view() runs on the compositor instead of a scroll handler, so the main thread stays free.

The displacement values are not arbitrary either. Most JS parallax libraries expose a speed parameter that maps to a symmetric range like from translateY(speed × 10 px) to translateY(speed × -10 px). The 30px above corresponds to speed: 3. Pick the magnitude directly in CSS, no library required.

No main thread work. No will-change — the browser already knows the element animates a compositor-friendly property.

I kept writing this same six-line block every time I needed scroll-driven motion in a React app, so I packaged it: @ouvarov/scroll-parallax — 349 B of JS gzipped, no scroll listener, no useEffect, no IntersectionObserver. Just a typed wrapper around animation-timeline: view().

import { Parallax } from "@ouvarov/scroll-parallax";

<Parallax amplitude={30}>
  <img src="/hero.jpg" alt="" />
</Parallax>

Enter fullscreen mode Exit fullscreen mode

Same compositor path as the raw CSS above — the component generates the keyframes and animation-timeline declaration for you, scoped per instance so sibling parallaxes don't bleed values into each other. Browsers without view() support render the element normally: no animation, no JS fallback, nothing to ship.

A diagnostic recipe

When you see a layer in DevTools you're not sure about:

  1. DevTools → Layers (More tools → Layers if not enabled)
  2. Sort by Memory estimate — biggest at the top
  3. Click each layer, read Compositing Reasons
  4. If the reason is Overlaps other composited content — this is a victim, not the trigger
  5. Look at neighbor layers in z-order (below in DOM, above in z)
  6. Find the one with an explicit reason — will-change, transform, filter, fixed, animation
  7. That's the trigger. Ask: does this layer actually need to exist?

Half the time the answer is no. Someone added will-change: transform to optimize a hover effect that runs twice a session. Or a library injected the hint without asking.

If you find will-change as an inline style that is not in your CSS — it's almost certainly third-party. Open Sources, grep node_modules for willChange. That's where it lives.

Closing

will-change is not free. And the cost is not measured at the element you touched. It is measured at the element that overlap dragged in.

Before you add a promoter, look at what sits next to it on screen. The biggest neighbor is paying the bill.

will-change is a wish. Overlap is a law.