17. Devices, Networks and Testing on Real Hardware
“Are these different for different devices? How can I check what renders on which device — can we do it?”— the author, asking exactly the right question
The story: the same race, different runners
Section titled “The story: the same race, different runners”Imagine a 100-metre race where every runner gets the same instructions, written in the same font, at the same moment. One runner is a sprinter in spikes on a dry track. Another is wearing chappals, carrying a bag of groceries, running on a wet road, uphill, at the end of a long day — and every few seconds has to stop because their legs get too hot.
Your web page is the instructions. Your MacBook Pro is the sprinter. Priya’s ₹12,000 phone is the second runner — on a congested 4G tower at 9 p.m., with a battery at 18%, in a warm room, with WhatsApp and three other apps holding memory. Same page, same code, completely different race.
This chapter answers the author’s question directly: yes, it’s different on every device, and yes, you can check — precisely. First we’ll see how different devices and networks are and why. Then we’ll build a toolkit: from DevTools throttling, to plugging a real phone into your laptop and recording a trace on it, to collecting real-user data from thousands of phones, to adapting your page to the device it lands on.
The device inequality gap
Section titled “The device inequality gap”The most important performance number most web developers never look at is single-core CPU performance, because the main thread (Chapter 11) runs on one core. More cores help the browser’s other threads and the OS, but your JavaScript, style, layout and paint mostly wait on one.
On single-core benchmarks, the gap between the fastest phones and the phones most people actually buy is large and persistent. As of the mid-2020s, broadly:
- Flagship iPhones have the fastest single-core performance of any phone, comparable to recent laptops.
- Flagship Androids (top Snapdragon/Dimensity chips) are close behind.
- Mid-range Androids (the ₹15,000–₹30,000 class) are typically around a third to a half of flagship single-core performance.
- Budget Androids (around ₹8,000–₹12,000) are typically around a fifth to a third of flagship — in the ballpark of a high-end phone from many years earlier.
The gap isn’t closing much, because the budget segment improves slowly and the top end keeps moving. And the budget and mid-range segments are where most phones are sold in India and in much of the world.
So a task that takes 40 ms on your laptop takes perhaps 150–250 ms on Priya’s phone. A 52 ms long task (the author’s Player) becomes a quarter-second freeze. A page using 144 CPU ms per second at idle on a Mac might need most of a core on a budget phone.
Thermal throttling
Section titled “Thermal throttling”Phones have no fans. When a chip runs hot — long gaming, charging, a warm room, a page burning CPU at idle — the OS throttles clock speeds to protect the hardware and the user’s hand. Performance can drop substantially after a few minutes of sustained load. Benchmarks are usually run cool; your users’ phones are often warm. A page that’s smooth for the first 30 seconds and stutters after five minutes may be throttling — and a page that keeps the CPU busy at idle (the author’s gallery) causes the throttling that then slows it down.
Memory limits
Section titled “Memory limits”Budget phones ship with 3–4 GB of RAM (some less), shared by the OS, the GPU and every app. The browser gets a fraction, and each tab a fraction of that. Under pressure, Android kills background tabs (you return to a tab and it reloads), and iOS kills web content processes that exceed limits — often without warning, mid-session. Large JS heaps, big decoded images (a 4000×3000 photo is ~48 MB decoded), many layers and GPU textures, and many iframes all push you toward that cliff.
GPU differences and blocklists
Section titled “GPU differences and blocklists”Mobile GPUs vary enormously, and so do their drivers. Browsers maintain GPU blocklists: specific GPU/driver combinations known to crash or render incorrectly get features disabled — GPU rasterization, WebGL, video decode acceleration. On a blocklisted configuration, work falls back to the CPU, and WebGL may run on a software renderer (historically SwiftShader in Chrome) or be unavailable entirely. Software WebGL works, but at a fraction of GPU speed: the author’s no-GPU numbers (27 and 21 FPS) show what that means.
You can see what the browser decided at chrome://gpu (on desktop and Android): which features are hardware-accelerated, which are software-only, and which driver bugs are being worked around.
Network realities
Section titled “Network realities”Chapter 5 established that latency dominates bandwidth on mobile. Let’s put shapes on it.
| Network | Typical RTT | Typical bandwidth | Packet loss | Notes |
|---|---|---|---|---|
| Home fibre / good Wi-Fi | 5–30 ms | 50–500 Mbps | very low | Developer reality |
| Good 4G | 40–80 ms | 10–40 Mbps | low | Decent, variable |
| Congested 4G (evening, crowded) | 100–300+ ms | 1–5 Mbps | moderate | Priya at 9 p.m. |
| 3G / weak signal | 200–500+ ms | 0.4–2 Mbps | high | Still real in many places |
| 5G (good) | 20–40 ms | 100+ Mbps | low | Great when present; drops to 4G often |
The numbers vary hugely by carrier, location and hour; what matters is the structure:
- RTT matters more than Mbps for typical pages: a page load is a chain of round trips (DNS, connect, TLS, HTML, discover, fetch…). At 200 ms RTT, ten sequential round trips are two seconds before bandwidth even matters.
- Variance matters: mobile RTT spikes when the radio wakes up from idle (the first request after a pause can pay hundreds of extra ms), during handovers between towers, and under congestion.
- Packet loss hurts TCP badly (retransmission + window shrink, Chapter 5), which is one reason HTTP/3 helps on mobile.
- Data cost matters: many users are on daily data caps and notice heavy pages.
Save-Dataand reduced-data preferences are real signals.
India’s mobile networks have improved dramatically in the 2020s — 4G is near-universal and 5G is widely deployed in cities — and median speeds are high. But medians hide evenings, crowds, buildings, trains and rural areas. Design for the p75 experience, not the median of a speed test.
The testing toolkit
Section titled “The testing toolkit”From cheapest-and-least-realistic to most-realistic:
1. DevTools CPU and network throttling
Section titled “1. DevTools CPU and network throttling”In the Performance panel, set CPU throttling (4× and 6× slowdowns, and in recent Chrome versions, presets calibrated to your machine to approximate low-tier and mid-tier mobile devices) and network throttling (presets like “Slow 4G” and “Fast 4G”, or custom profiles with latency and bandwidth).
Limitations to keep in mind:
- CPU throttling slows the renderer’s main thread by inserting waits. It doesn’t model a weaker GPU, slower memory, a smaller cache, thermal throttling, or the phone’s OS overhead.
- Network throttling is applied in the browser, per request, with simple latency and bandwidth caps. It doesn’t model packet loss, radio wake-up, TCP slow start behaviour faithfully, or variance.
- Your laptop’s GPU is still your laptop’s GPU — GPU-bound effects (blurs, glass) will look fine under “6× CPU” and still stutter on a real phone.
Use throttling to find main-thread problems quickly. Never use it to certify that something is fast on phones.
2. Lighthouse and PageSpeed Insights
Section titled “2. Lighthouse and PageSpeed Insights”PageSpeed Insights runs Lighthouse from Google’s servers on a simulated mid-range mobile profile, and — crucially — shows CrUX field data for your URL and origin if there’s enough traffic. Start every investigation of a live site here: field first, lab second.
3. WebPageTest
Section titled “3. WebPageTest”WebPageTest runs real browsers on real devices (including real Android phones) in many locations around the world, on chosen connection profiles, with filmstrips (a screenshot every 100 ms), video, full waterfalls, CPU traces, and repeat-view (warm cache) runs. It’s how you answer “what does a first visit look like on a Moto-class phone in Mumbai on 4G?” without owning that phone. Tips: run at least 3–5 runs and look at the median; compare first view vs. repeat view; use the filmstrip to see what users see at each moment (it’s the best tool for explaining performance to non-engineers).
4. Remote debugging a real Android phone
Section titled “4. Remote debugging a real Android phone”This is the single most valuable skill in this chapter. You get the full DevTools — Elements, Console, Network, Performance — connected to Chrome running on the phone, measuring the phone’s real CPU, GPU, memory and network.
The steps, conceptually:
- On the phone: enable Developer options (Settings → About phone → tap “Build number” seven times), then turn on USB debugging in Developer options.
- Connect the phone to your computer with a USB cable (a data cable, not a charge-only one). Accept the “Allow USB debugging?” prompt on the phone.
- On your computer: open Chrome and go to
chrome://inspect#devices. Your phone appears with its open Chrome tabs. - Open your page on the phone (or type a URL into the inspect page), click inspect. A DevTools window opens, showing a live mirror of the phone’s screen.
- In that DevTools window, go to Performance, record, interact on the phone, stop. You now have a trace from the real device: real main-thread durations, real GPU behaviour, real long tasks.
You can also use port forwarding in chrome://inspect so the phone can open localhost:3000 from your laptop’s dev server — but remember to profile a production build (Chapter 10) on a realistic network (the phone’s own 4G, not your laptop’s Wi-Fi forwarded).
5. Debugging a real iPhone
Section titled “5. Debugging a real iPhone”With a Mac: on the iPhone, enable Web Inspector (Settings → Safari → Advanced; on recent iOS versions under Settings → Apps → Safari → Advanced). Connect via USB (or, once paired, sometimes over the network). On the Mac, enable Safari’s Develop menu (Safari → Settings → Advanced → “Show features for web developers”). The iPhone appears in the Develop menu; choose the page to open Safari Web Inspector — elements, console, network, and a Timelines tab that records JavaScript, layout and rendering, and frame rates.
Remember: on iOS, every browser is WebKit (Chapter 8), so Safari’s inspector tells you what Chrome-on-iPhone users experience too.
Without a Mac, your options are weaker: cloud device labs with real iPhones (below); third-party tools that bridge iOS’s debugging protocol on Windows/Linux (functional for console and DOM inspection, more limited for performance); testing WebKit behaviour via Playwright’s WebKit build (useful for correctness, not for iPhone performance); and, practically, borrowing a Mac for a day of profiling each release cycle.
6. Device labs
Section titled “6. Device labs”BrowserStack, LambdaTest and similar services rent you real phones in a data centre, controlled through your browser, with DevTools access on many Android devices and Web Inspector on iOS. Good for coverage (that one Samsung model with a weird WebView; an old iPhone pinned to an old iOS). Limitations: the network is the data centre’s, the devices are often cool and freshly reset (no thermal throttling, no background apps), and interacting through a video stream adds latency to your experience. Great for correctness and spot checks; less faithful for performance than a phone in your hand on a real network.
7. Field data: CrUX, CrUX Vis, Search Console
Section titled “7. Field data: CrUX, CrUX Vis, Search Console”- CrUX — field data from real Chrome users at origin and URL level: LCP, INP, CLS, FCP, TTFB distributions, split by device type (phone/desktop/tablet), 28-day rolling windows. Free. Available via PageSpeed Insights, a public API, BigQuery (monthly datasets), and CrUX Vis (a visualization tool for trends over time). The limitation: only Chrome users who opted in, only sites/pages with enough traffic, aggregated (no “why”), and lagging by up to a month.
- Search Console’s Core Web Vitals report groups your URLs by status (Good / Needs improvement / Poor) using CrUX data, which is how SEO teams usually first notice a problem.
8. RUM: your own field data, with the web-vitals library
Section titled “8. RUM: your own field data, with the web-vitals library”Real User Monitoring means measuring on your actual users’ devices and sending the data to yourself. Unlike CrUX, you get every browser that supports the APIs, any page regardless of traffic, real-time data, and — most importantly — your own dimensions: route, device class, connection type, country, logged-in state, A/B variant, release version.
Google’s web-vitals library (a few KB) does the hard part: it measures LCP, INP, CLS, FCP and TTFB exactly the way Chrome and CrUX do, handling the edge cases (bfcache restores, prerendering, hidden pages, session windows).
import { onLCP, onINP, onCLS } from 'web-vitals/attribution';
function send(metric) { const body = JSON.stringify({ name: metric.name, value: metric.value, rating: metric.rating, id: metric.id, route: location.pathname, // attribution tells you WHY: e.g. the LCP element and its sub-parts, the slow interaction's target attribution: metric.attribution, mem: navigator.deviceMemory, cores: navigator.hardwareConcurrency, net: navigator.connection?.effectiveType, }); navigator.sendBeacon('/rum', body) || fetch('/rum', { body, method: 'POST', keepalive: true });}onLCP(send); onINP(send); onCLS(send);Key ideas:
- The library reports when the value is final (usually when the page is hidden — remember Chapter 14’s “hidden is your last reliable moment”), using
sendBeaconso the request survives the page going away. - The attribution build adds diagnostic detail: for LCP, the element and the four sub-parts; for INP, the interaction target, the event type, the three phases and LoAF script attribution; for CLS, the largest shifting element. This turns “INP is bad” into “INP is bad on
/dashboardwhen tapping.filter-chip, mostly processing time inapplyFilters.” - On the server side, store the beacons and segment: p75 by route × device class × connection × country. A metric that looks fine overall can be awful for “mobile, 4G, India,
/search.”
Detecting capability at runtime
Section titled “Detecting capability at runtime”You can’t fix the device inequality gap, but you can adapt to it. Signals available in the browser (several are Chromium-only; always feature-detect and treat as hints):
navigator.hardwareConcurrency— number of logical CPU cores. Rough signal of device class (budget phones: often 4–8 “cores” but slow ones — it’s a weak signal alone).navigator.deviceMemory— approximate RAM in GB, rounded and capped (e.g., 0.25 to 8) to limit fingerprinting. Chromium only. A good signal: ≤ 2–4 GB means be careful.- Network Information API (
navigator.connection) —effectiveType(slow-2g,2g,3g,4g— an estimate from recent measured RTT and throughput, not the radio technology),rtt,downlink, andsaveData(the user asked to save data). Chromium only. prefers-reduced-motion,prefers-reduced-data(limited support),prefers-reduced-transparency— user preferences in CSS andmatchMedia.- WebGL renderer string — create a WebGL context and read the renderer (via
WEBGL_debug_renderer_infowhere exposed). A software renderer name (e.g., containing “SwiftShader”) tells you there’s no GPU acceleration. Failure to create a context at all tells you WebGL is unavailable. - Measured performance — the most honest signal: time a small representative workload at startup, or watch frame times for the first few seconds of an animation (if rAF intervals are consistently > 20 ms, step down).
Adaptive loading
Section titled “Adaptive loading”Adaptive loading serves lighter experiences to weaker devices and networks:
- Low memory or Save-Data: lower-resolution images, no autoplay video, fewer prefetches.
- Slow effective connection: skip non-essential third parties, show static previews instead of live embeds.
- Weak CPU/GPU or software WebGL: static glass instead of live lens filters; fewer particles; lower canvas resolution (render at 0.5× device pixel ratio and upscale); 30 FPS cap for decorative animation.
- Reduced motion: replace motion with fades (Chapter 19).
const weak = (navigator.deviceMemory && navigator.deviceMemory <= 4) || (navigator.hardwareConcurrency && navigator.hardwareConcurrency <= 4) || navigator.connection?.saveData || matchMedia('(prefers-reduced-motion: reduce)').matches || isSoftwareWebGL();document.documentElement.dataset.fx = weak ? 'static' : 'live';Then CSS and components key off [data-fx="static"]. Done carefully, everyone gets a page that works well on their device, instead of everyone getting the flagship experience at whatever speed their phone can manage.
A repeatable test matrix
Section titled “A repeatable test matrix”Make testing boring and routine. A matrix for a project with Indian mobile users might be:
| Tier | Device | Browser | Network | When |
|---|---|---|---|---|
| Reference low | A real budget Android (~₹10–12k, 4 GB) | Chrome | Its own 4G, evening | Every release, key flows, recorded trace |
| Reference mid | A real mid-range Android | Chrome | 4G | Every release |
| iOS | An older iPhone (2–3 generations back) | Safari | 4G/Wi-Fi | Every release |
| Desktop | Integrated-GPU Windows laptop | Chrome, Edge | Wi-Fi | Every release (GPU-heavy features) |
| Desktop alt | Mac | Safari, Firefox | Wi-Fi | Monthly |
| Synthetic | WebPageTest mid-range Android, Mumbai, 4G | Chrome | Emulated 4G | Nightly on key URLs |
| Lab gate | Lighthouse CI | Chrome | Simulated | Every PR |
| Field | RUM + CrUX | All | Real | Continuous; weekly review |
The budget Android is the most important device you can buy for your team. Put it on a desk, give it a name (the book suggests “Priya”), and make “it’s fine on Priya” part of your definition of done.
What you now know
Section titled “What you now know”You can explain the device inequality gap and why single-core performance matters most; account for thermal throttling, memory limits and GPU blocklists; reason about networks in RTT, variance and loss rather than Mbps; use DevTools throttling knowing its limits; remote-debug a real Android phone and an iPhone and record a trace on them; use device labs, WebPageTest, PSI, CrUX and Search Console for what each does best; build RUM with web-vitals and attribution and segment it; detect capability at runtime and implement adaptive loading; and design a repeatable test matrix. In short: yes, you can check what renders on which device — and now you know how.
Self-quiz
Section titled “Self-quiz”1. Why does single-core performance matter more than core count for most page work?
JS, style, layout and paint mostly run on one main thread.
2. Name two things DevTools CPU throttling doesn’t model.
Weaker GPU, memory limits, thermal throttling, OS overhead.
3. Where do you enable remote debugging on Android?
Developer options (unlocked by tapping Build number) → USB debugging; then chrome://inspect on the computer.
4. What does effectiveType: ‘3g’ mean?
Recently measured RTT/throughput resemble 3G — not that the radio is 3G.
5. What does the web-vitals attribution build add?
Diagnostic detail: LCP element and sub-parts, INP target and phases (and LoAF info), CLS largest shift source.
Exercises
Section titled “Exercises”Warm-up 1. Scale the trace. A route change on your laptop shows 90 ms of scripting and 40 ms of style/layout. Estimate it on a budget phone and say whether INP is at risk.
Solution
At ~4–5× slower: ~400–600 ms of main-thread work. Yes — any tap during it waits, and the interaction itself would be in the “poor” range.
Warm-up 2. Pick the tool. Which tool answers: (a) is our p75 LCP good this month? (b) what does a first visit look like in Mumbai on a real mid-range Android? (c) why is this tap slow on my phone? (d) which route has the worst INP for 4G users?
Solution
(a) CrUX/PSI or RUM; (b) WebPageTest; (c) remote debugging trace on the phone; (d) segmented RUM.
Warm-up 3. Signal or noise? A user has hardwareConcurrency = 8. Is the device fast?
Solution
Not necessarily — many budget phones have 8 slow cores. Combine with deviceMemory and measured performance.
Lab 4. Profile Lumen on a real phone. Remote-debug Lumen’s production deployment on an Android phone over its own mobile data. Record page load and a route change. Compare with your laptop’s 4× throttled trace.
Expected outcome
The phone trace is slower than the throttled laptop in places throttling doesn’t model (GPU work, image decode, memory). Note the biggest differences.
Lab 5. WebPageTest. Run Lumen on WebPageTest with a mid-range Android in India on 4G, 5 runs, first and repeat view. Save the filmstrip for the median run.
What to look for
When content first appears, when the hero appears, and what changes between frames. The repeat view shows how well your caching works.
Lab 6. RUM for Lumen. Add web-vitals/attribution to Lumen, a /rum endpoint on your VPS that appends JSON lines to a file, and a script that computes p75 per route and device class.
Expected outcome
A table of p75 LCP/INP/CLS by route × device class from your own visits on different devices.
Lab 7. Adaptive tiers. Implement full/lite/minimal tiers for Lumen’s hero (prepared for Chapter 20’s WebGL hero): detect signals, set a data attribute, and render accordingly. Test by emulating reduced motion and by forcing the “lite” path.
Hint
Keep the decision in one small module, log the chosen tier to RUM, and allow a query parameter override for testing.
Staff 8. Buy the phones. Write a short proposal to buy three reference devices for the team, with the expected value and how they’ll be used.
Model answer
Cost is trivial relative to engineer time; they catch the class of problems field data reveals weeks late; specify the models by price tier matching your audience; define the per-release check ritual and who owns it.
Staff 9. Explain the gap. A PM asks why the app “is fine for everyone in the office but users complain.” Write the explanation, with one chart you’d show.
Model answer
Show the CPU gap chart and the RUM p75 by device class; explain that the office runs on the fastest 5% of devices on the fastest networks; propose the reference-device ritual and RUM segmentation.