English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

From URL to Pixels: What Modern Browsers Really Do Behind the Scenes

Forum topic · 小凯 · 2026-06-28

Summary

A detailed Chinese forum post breaks down what actually happens when a URL is entered in a modern browser, drawing on Addy Osmani's writing on how browsers work. Beyond the classic 12-step model (DNS, TCP, TLS, HTTP, DOM/CSSOM, layout, paint, composite), the post explains Chrome's hidden optimizations: the preload scanner (~20% faster page loads but defeated by JS-hidden resource URLs), Speculation Rules API prerendering, HTML state-machine parsing with 80+ states, CSS context-free-grammar parsing, V8's JIT pipeline (Ignition interpreter + TurboFan optimizer), hidden classes, generational garbage collection, and Chrome's multi-process architecture with site isolation. It covers the render pipeline (JavaScript, Style, Layout, Paint, Composite), the cost hierarchy of reflow vs repaint vs composite, forced synchronous layouts, Core Web Vitals (LCP, INP, CLS), resource priority hints via fetchpriority, and Osmani's '70% problem': most performance issues stem from unoptimized images, uncompressed JS/CSS, render-blocking resources, and fonts. Key advice: keep critical resources visible in HTML, avoid layout thrashing, prefer transform/opacity, inline critical CSS, and defer non-critical JavaScript.

From URL to Pixels: What Modern Browsers Really Do Behind the Scenes

> Core intuition: In the 0.1 seconds after you press Enter, the browser has already done dozens of things — DNS lookup, TCP handshake, TLS negotiation, HTML parsing, CSS parsing, JavaScript compilation, DOM construction, style calculation, layout, paint, compositing. Yet most developers know nothing about these "black box" operations and end up guessing when optimizing performance. Addy Osmani — who wrote a browser at 16 and later led Chrome's Developer Experience team — lays it all out.

This post is a structured English summary of the original Chinese article, which is based on Addy Osmani's "How Modern Browsers Work."

Key points

  • The classic interview answer (DNS → TCP → TLS → HTTP → DOM → CSSOM → render tree → layout → paint → composite) is a 1980s-era linear mental model. Modern browsers run dozens of speculative, parallel optimizations within ~200 ms.
  • Preload scanner: while the HTML parser is blocked on a synchronous script, a separate scanner "peeks ahead" at the raw markup and starts downloading resources early — worth about 20% faster page loads in Chrome's experiments. It cannot execute JavaScript, so URLs generated dynamically in JS are invisible to it. Fix with static markup or <link rel="preload"> + fetchpriority="high".
  • Speculative loading: the Speculation Rules API lets Chrome prerender likely next pages (already used on Google Search results), making navigation feel instant.
  • Parsing

  • HTML parsing is a state machine with 80+ states defined by the HTML5 spec, built for fault tolerance on malformed markup.
  • CSS is parsed as a context-free grammar: tokenization, then parsing into a rule tree. Unknown properties invalidate the entire declaration — order matters for vendor prefixes.
  • Critical rendering path: synchronous JS blocks DOM construction; CSS blocks rendering; synchronous JS also blocks CSSOM construction. Hence "CSS in head, JS at end of body" is not dogma — it lets the browser build the render tree as early as possible.
  • V8 and JavaScript execution

  • JIT compilation: all JS starts on Ignition (bytecode interpreter); hot code is promoted to TurboFan (optimizing compiler), with deoptimization when assumptions break (e.g., changed types).
  • Hidden classes: objects with the same property shape share hidden classes; adding properties at runtime (like p3.z = 7) forces new hidden classes and kills optimizations. Keep property creation order consistent; keep arrays single-typed.
  • Garbage collection: generational — Scavenge (fast, copying) for the young generation, Mark-Sweep-Compact for the old generation, mitigated by incremental marking and concurrent sweeping. Avoid churning temporary objects.
  • Chrome's architecture and render pipeline

  • Multi-process design: Browser process, sandboxed Renderer process per tab/site, GPU process, Network Service, utility processes — for security, performance, and isolation. Site Isolation gives each website (even inside iframes) its own renderer.
  • Pipeline: JavaScript → Style → Layout → Layer → Paint → Composite.
  • Cost hierarchy: layout changes (width, top, left) are most expensive; repaints (color, visibility) are medium; compositor-only changes (transform, opacity) are cheapest.
  • Forced synchronous layout — interleaved reads (offsetHeight) and writes in a loop — is a classic performance killer. Batch all reads, then all writes.
  • Performance guidance (Core Web Vitals)

    | Metric | Measures | Target | |---|---|---| | LCP | Largest contentful element rendered | ≤ 2.5 s | | INP (formerly FID) | Interaction-to-next-paint latency | ≤ 200 ms | | CLS | Cumulative layout shift | ≤ 0.1 |

    Practical checklist from the article:

  • Keep the LCP element directly visible in HTML; never insert it via JS; use fetchpriority="high".
  • Set explicit width/height on images and embeds to avoid layout shift.
  • Inline critical CSS; defer non-critical JS (async/defer); code-split; lazy-load images; use WebP/AVIF; subset fonts.
  • Understand browser resource priorities (HTML, sync CSS, and fonts = Highest; prefetch = Lowest) and tune with fetchpriority.
  • The "70% problem"

    Osmani's breakdown of common performance issues: unoptimized images (~30%), uncompressed JS/CSS (~20%), render-blocking resources (~15%), font loading strategy (~5%). Roughly 70% of performance problems are solved by basics, not advanced techniques.

    Takeaway

    > Don't fight the browser — work with its rules: keep critical resources visible in HTML, minimize reflow/repaint (prefer transform), control the number of critical resources, and respect resource priorities.

    > "If you don't understand how the browser loads, parses, and renders your code, your optimizations are guesswork — and guesses are usually wrong." — Addy Osmani

    References

  • Addy Osmani, "How Modern Browsers Work," Medium, 2025
  • Addy Osmani biography: https://addyosmani.com/bio/
  • Ilya Grigorik, *High Performance Browser Networking* (O'Reilly)
  • Chrome Developers Documentation: developers.google.com/web
  • V8 Blog: v8.dev/blog

Tags

#browser-internals#performance-optimization#v8#chrome#core-web-vitals#rendering-pipeline#jit-compilation#preload-scanner

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178208233