← All articlesMUMITUL
Research Desk · RD-05

Web Performance Optimization

13 min read·2,618 words

Web performance is often discussed as a single number: how fast a page loads. That framing hides the questions that determine whether an optimization worked. Fast for whom, on which device, over what network, and at which moment — the first paint, the main content, or a tap minutes into the session? The load event records when downloads finish, not when content becomes usable.

This deep dive treats performance optimization as a measurement discipline rather than a collection of techniques. That framing is a synthesis of Google’s Core Web Vitals guidance on web.dev, MDN’s web performance documentation, the Chrome UX Report’s field-data methodology, the HTTP Archive’s Web Almanac analysis, and web.dev’s performance-budget guidance. [1–6] It examines the Core Web Vitals, the rendering path, JavaScript’s outsized costs, lab versus field measurement, and enforceable budgets.

01 · Define performance as a user experience, not a load time

A page is experienced as a sequence of moments, not as one event. Content appears, the main content becomes visible, controls start responding, and the layout settles. User-centric measurement tracks distinct milestones — rendering, loading, responsiveness, stability — instead of asking only when loading finished.

Performance is also a distribution, not a single observation. The same page reaches flagship phones on fast connections and low-cost devices on congested networks, and those experiences can differ by an order of magnitude. An average, or testing only on the developer’s hardware, conceals the slowest experiences, which usually decide whether people stay. Any credible claim should state its population and percentile.

This caution applies to business-impact claims. Faster pages are widely reported to retain users better, but the effect’s size in a particular product depends on its audience, tasks, and baseline. Published effect sizes are hypotheses to test against local evidence, not promised returns.

Synthesis recommendation: define the experience before choosing metrics. Record the key templates, the moments that matter on each — main content visible, primary control responsive, layout stable — and the device and network conditions representing the actual audience, including its slower members. Evaluate every later optimization against that definition: whether defined users reach defined moments sooner, not whether a score improved.

02 · Use Core Web Vitals as the shared threshold language

Core Web Vitals give that definition a common vocabulary. Largest Contentful Paint (LCP) measures loading — until the largest content element in the viewport renders — good at 2.5 seconds or less. Interaction to Next Paint (INP) measures responsiveness across the page’s life, good at 200 milliseconds or less. Cumulative Layout Shift (CLS) measures visual stability, good at 0.1 or less. [1]

The thresholds are assessed at the 75th percentile of real visits, segmented by device class, and a page passes only when all three metrics pass at that percentile. [1,5] The percentile matters as much as the numbers: a median LCP of two seconds can coexist with a quarter of visits waiting far longer, and the 75th-percentile rule keeps those visits visible. An average misrepresents the method.

The metric set is maintained guidance, not a permanent fixture. INP replaced First Input Delay as a Core Web Vital in March 2024. [1] Assessments should record which guidance version they used. Google also incorporates Core Web Vitals into its page experience signals for Search, making them commercially relevant — but a ranking input is not evidence that passing guarantees any position or traffic outcome.

Synthesis recommendation: adopt the three thresholds as acceptance criteria in their documented form — LCP at or below 2.5 seconds, INP at or below 200 milliseconds, CLS at or below 0.1, each at the 75th percentile, reported separately for mobile and desktop. Treat them as a shared floor for a healthy experience, not the limit of what an audience may need.

03 · Separate field evidence from lab diagnosis

Field data describes what real users experienced. The Chrome UX Report (CrUX) aggregates anonymized measurements from opted-in Chrome users; the official assessment uses a rolling 28-day window and reads each metric at the 75th percentile. [5] Field data alone can establish whether a page meets the thresholds, because they are defined over real visits. Its limits are aggregation and delay: results blend devices and networks, and fixes take weeks to show.

Lab data answers a different question. Tools such as Lighthouse load a page under controlled conditions — a defined device profile, throttled network and CPU — and produce a reproducible result with diagnostic detail: waterfalls, render-blocking resources, long tasks, estimated savings. [1] That control is what makes lab tests diagnostic. It is also why a lab result cannot certify field performance: one simulated environment is not the audience’s distribution.

Disagreement between the two is expected, not a tooling error. Lab tests start with a cold cache; returning visitors may load much of the page from cache. A page can pass in the lab and fail in the field because real users arrive on slower devices, interact earlier, or exercise code paths a scripted test never touches. Identify which condition differs rather than averaging the two.

Synthesis recommendation: assign each kind of evidence its own job. Use field data to decide whether a problem exists, how large it is, and whether a shipped change improved real visits. Use lab data to reproduce the problem, locate its causes, and verify a fix before release. Never announce an improvement from lab results alone — field confirmation over the following CrUX window completes the claim.

04 · Trace the critical rendering path before optimizing

The critical rendering path is the sequence the browser must complete before it can paint. It parses HTML into the Document Object Model (DOM) and CSS into the CSS Object Model (CSSOM), combines them into a render tree, calculates layout, and paints pixels. [3] Until the render tree exists, nothing appears — so faster rendering means shortening this path.

Two blocking behaviors dominate the path. CSS is render-blocking by default: the browser will not paint until the needed stylesheets are downloaded and parsed. JavaScript is parser-blocking by default: a script without an async or defer attribute halts parsing while it downloads and executes. [3]

The consequences follow directly. Styles for the initial view should arrive efficiently, with non-critical styles deferred where safe. Scripts should carry defer or async unless they must run in order during parsing; third-party tags deserve the same scrutiny as first-party code. Inlining critical CSS can remove a blocking round trip, but trades against caching and should be measured, not habitual.

Synthesis recommendation: draw the rendering path for each key template from an actual lab trace before optimizing anything else. List every blocking resource on the path to first paint, its owner, and why it blocks. Remove, defer, or shrink blocking work in that order. Without this map, optimization targets whatever is easiest to change rather than what the browser is waiting for.

05 · Decompose LCP into its subparts before treating it

LCP failures have different causes; the remedy depends on which subpart is slow. web.dev decomposes LCP into four subparts: time to first byte (TTFB); resource load delay, until the browser starts loading the LCP resource; resource load duration, its download time; and element render delay, until it paints. [2] A page whose time concentrates in one subpart is indicating where to work.

Each subpart points at a different layer. A dominant TTFB implicates the server or network path; front-end tuning will not repair it. A long load delay usually means late discovery — the resource referenced from CSS or inserted by JavaScript instead of the initial HTML. A long load duration indicates an oversized resource or slow connection. A long render delay suggests main-thread work postponing the paint. [2]

Discovery is cheap to fix and commonly wrong. The LCP element — often a hero image or headline block — should be discoverable in the initial HTML so the preload scanner can request it early. fetchpriority="high" prioritizes it over competing requests; lazy-loading it is a documented anti-pattern. Preload can start the download early, but misapplied it competes with requests that matter. [2]

Synthesis recommendation: record the four subparts for every failing template in lab tests and keep the breakdown with the performance report. Treat the largest subpart first and re-measure, because reducing one can expose another. Reject any remedy — a CDN, an image format, a preload — not connected to the subpart it should shrink.

06 · Treat JavaScript as the most expensive resource

JavaScript bytes cost more than other bytes of the same size. An image is downloaded, decoded, and painted; a script is downloaded, decompressed, parsed, compiled, and executed, occupying the main thread. [1,3] The cost is paid twice: in bandwidth, and in delayed interactions. On low-cost processors, parse and execution dominate, so script-heavy pages degrade most for users least able to replace their devices.

The aggregate trend is unfavorable. The HTTP Archive’s Web Almanac, analyzing millions of pages with Lighthouse and CrUX data, documents continued growth in shipped JavaScript and overall page weight. [4] Third-party scripts add a further problem: they can regress performance without any first-party change.

The browser gives this cost a unit of account. Main-thread work divides into tasks; a task over 50 milliseconds is a long task, during which the browser cannot respond to input or paint. [1] Reducing it means shipping less — code-splitting by route, removing unused code — and scheduling the rest so no task monopolizes the thread. Moving execution earlier or later changes when the cost is paid, not whether.

Synthesis recommendation: account for JavaScript separately from every other asset class. Set an explicit script budget per template, and require each bundle and third-party tag to have a named owner and a stated purpose. Evaluate a proposed script by total cost — transfer, parse, execution, and the interactions it can delay — not by download size alone.

07 · Engineer responsiveness and stability, not just loading

INP extends measurement across the whole visit. It is built from real interactions — clicks, taps, key presses — and reports a value near the worst of them. web.dev breaks an interaction into three phases: input delay, processing duration, and presentation delay — until handlers begin, while they run, and until the browser paints the response. [1,2] Each phase has different remedies, so one figure starts a diagnosis rather than completing it.

Input delay is usually a main-thread problem: a long task, often unrelated script execution, prevents the browser from starting to handle the interaction. Processing duration is the application’s own cost, reducible by doing less work per interaction, deferring non-urgent work, and breaking long handlers into smaller tasks. Presentation delay grows with expensive rendering, such as large DOM updates. [2] Responsiveness is scheduled, not hoped for: deliberate yielding keeps latency bounded.

CLS is a different failure — not slowness but movement. Shifts occur when content is inserted above existing content, when embeds load without reserved space, or when images arrive without dimensions to hold their place. Width and height attributes, or an equivalent CSS aspect ratio, reserve the space before the resource loads. [2]

Synthesis recommendation: test interactions, not only loads. Script the key journeys in lab tooling and inspect the three INP phases for the slowest interactions; in the field, segment INP by interaction type before assigning fixes. For stability, treat reserved space as a default: no image, embed, or banner enters a template without dimensions or an allocated slot.

08 · Optimize delivery of images, fonts, and cached assets

After blocking behavior and JavaScript, delivery is the remaining lever — how many bytes move, in what form, and how often — and images are its first target, typically much of page weight, as the Web Almanac documents. [4] Serve images at display size with responsive markup, use WebP or AVIF where supported, and compress deliberately. [3] An image at twice its display size carries four times the pixels, and every visitor pays for the excess.

Fonts sit on both the loading and stability paths. On text-heavy pages the LCP element is often the headline, so a late font delays the largest paint, and a swapping font can shift rendered content. Subsetting, limiting weights and families, an explicit font-display strategy, and preloading only the critical file are the standard controls. [2,3] Each control involves a trade-off that should be chosen, not inherited from a framework default.

Finally, the cheapest request is the one that never happens. Brotli or gzip compression reduces text transfer; long-lived cache headers with content-hashed filenames let returning visitors reuse assets; a CDN shortens the path for distant users, appearing in TTFB and therefore LCP. web.dev treats a TTFB of 0.8 seconds or less as a useful target for keeping the subparts in balance. [2]

Synthesis recommendation: audit delivery in a fixed order — image sizing and format, font loading, compression, cache lifetimes, then network distance — and record the bytes saved at each step. Verify changes in the lab waterfall and watch the LCP subparts, confirming the savings reached the metric rather than merely shrinking a total.

09 · Set performance budgets that bind decisions

A budget converts performance from an aspiration into a constraint other decisions must respect. web.dev defines a performance budget as a set of limits on metrics and resources: total script size, request counts, and thresholds such as LCP or INP targets. [6] The value is not the numbers but the moment they apply. Checked after launch it produces a report; checked in the build, it produces a decision — reduce, except, or accept a trade-off.

Effective budgets combine both kinds of limits. Metric budgets express the user-facing goal — LCP at or below 2.5 seconds on a mid-range device under lab throttling — but lab conditions can be gamed. Resource budgets constrain the inputs — total JavaScript, image weight, third-party origins — and enforce automatically, but a page can satisfy them and still be slow. [6] Each kind checks the other: resource budgets catch bloat; metric budgets catch harmful arrangements.

Budget levels should be set from evidence, not aspiration. A team whose field LCP is five seconds gains little from a 2.5-second budget everyone ignores; a staged budget starting near the baseline and tightening on a published schedule changes behavior because it can be met. [6] Budgets also need an exception process with an owner and an expiry, so a campaign page’s month over the script budget lapses as a recorded decision, not silent drift.

Synthesis recommendation: publish one budget set per key template — a metric limit, a JavaScript limit, a total-weight limit — each with a named owner. Enforce them in the build and reconcile against field data monthly. Treat a breach as a defect — triaged, assigned, and either fixed or formally excepted — because an ignorable budget is documentation, not a control.

10 · Operate performance as a continuous regression discipline

Performance decays by default. Features accumulate, tags multiply, images grow, and dependencies expand, so an optimized page drifts slower with each release. The durable unit of quality is not the audit but the operating loop around it: field monitoring to detect change, lab diagnosis to explain it, a budget to judge it, and an owner with authority to act.

The loop has a timing constraint. Because the field assessment rolls over 28 days, regressions and fixes alike take weeks to fully register. [5] Lab gates and faster real-user monitoring are therefore necessities: they catch a bad release before it spends a month in the field data. Releases should include a lab check on key templates; significant launches need field review, not assumed success.

Not every cost should be removed. Some scripts earn their latency — payment, accessibility tooling, a feature users demonstrably value — and some pages are legitimately heavy because their content is the point. The discipline is not minimalism; it is that each cost is known, measured, and accepted by someone accountable.

Practiced this way, performance optimization is a chain of evidence. Define the experience; measure it in the field at the 75th percentile; diagnose it in the lab; spend effort where JavaScript and delivery costs sit; hold the result with budgets. No technique substitutes for the others, and no lab score closes the argument. The field data is the verdict, delivered by the slowest quarter of the audience.

Sources: [1] Google, web.dev — Core Web Vitals guidance, including the LCP, INP, and CLS thresholds and the replacement of FID by INP. [2] Google, web.dev — the Optimize LCP, Optimize INP, Optimize CLS, and Optimize TTFB guides, including the LCP subpart and interaction phase models. [3] MDN Web Docs — Web performance documentation, including the critical rendering path. [4] HTTP Archive — Web Almanac, an annual analysis based on Lighthouse and CrUX data. [5] Google — Chrome UX Report documentation, including the 28-day rolling window and 75th-percentile methodology. [6] Google, web.dev — performance budget guidance, including “Performance budgets 101.”

More articles at mum.name/blog