CSE 134B Web Client Languages
  1. Foundations
  2. Qualities
  3. Performance

Quality

Performance

Performance is whether the page keeps up with the person using it: it arrives while they still care, and it answers when they act. Every layer of the page spends that time or saves it.

What it means for a web client

“The site should be fast” is not a requirement, because fast is an adjective and you cannot test an adjective. Performance becomes engineering when you write numbers down before you build. The course uses Google's RAIL model as a starting set, and its numbers come from people, not servers: respond to input within 100 ms, produce each animation frame in about 10 ms, do background work in slices of 50 ms or less, and load in 5 seconds on a mid-range phone over a slow connection. Core Web Vitals measure the same concerns from real visits: LCP for when the main content appeared, INP for how quickly the page answers input, and CLS for whether things jump while you read.

Two kinds of time matter to a web client. The first is arrival: round trips, requests and bytes on a network you do not control. The Request Lifecycle makes this rung two of its ladder: a page that needs thirty seconds on a hotel connection is, for that visitor, down. The second is responsiveness: once the page is there, the main thread runs your JavaScript, style, layout and paint one thing at a time and any long task means dropped frames and unanswered taps.

The course compresses the arrival half into one line, the Performance Law: send less data, less often, from nearby, and only when needed. The responsiveness half has its own version: do less on the main thread, and do it less often. Both start from who is actually visiting. Your laptop on campus Wi-Fi is not a typical visitor. A mid-range phone on a slow network is much closer to one.

Where it lives in each layer

Structure
HTML is a list of other URLs, and each one becomes a request, so the markup decides the shape of the load. Content that arrives in the HTML is usable before any script runs. A plain <script> in <head> stops the parser; defer, async and module scripts do not. loading="lazy", preload and preconnect tell the browser what matters first, and declared image dimensions reserve space so nothing shifts when the image lands.
Presentation
Stylesheets block rendering on purpose, and every font weight is another download. A visual change costs according to where it enters the pipeline: width or top forces layout, paint and composite; transform and opacity run on the compositor alone. Late-arriving images and fonts that change geometry cause layout shift, the pipeline's most user-hostile behavior.
Interaction
JavaScript runs to completion on the same thread that renders, so a 40 ms handler costs dropped frames and ignored input. High-frequency events such as scroll and pointermove call for throttle or debounce, and { passive: true } lets scrolling proceed without waiting for you. Alternating DOM writes and geometry reads causes layout thrash; observers, event delegation, yielding and Web Workers keep work off the critical path.
Delivery
Every request pays in round trips: a DNS lookup, a TCP handshake, a TLS exchange and the request itself, about four on a cold start, more with a redirect. The HTTP cache skips the trip entirely while a response is fresh and turns a stale one into a small 304. Compression shrinks text. The bytes you choose to send (a whole page or a fragment, JSON or multipart) and the timeouts you set decide how your client behaves on a slow link.

Where the course teaches it

Check your own page

  1. Open the Network panel with the cache disabled and count the requests and total transfer size.
  2. Throttle to a slow mobile profile and reload. Note how long until real content appears, and whether anything in <head> holds it back.
  3. View source. If the main content is not in the HTML, the page is waiting on a script for its existence.
  4. Reload with the cache enabled. Check that your CSS, scripts and images come from the cache or return 304, and read their Cache-Control headers.
  5. Record a Performance trace while scrolling and clicking. Look for long tasks, and for layout or paint running every frame during an animation.
  6. Find every <img> without width and height, and every scroll or input handler that runs real work on each event.