Skip to content

Why our mobile PageSpeed score swung between 80 and 100

6 min readProTechBridge

Six Lighthouse runs of one unchanged build of this site scored anywhere from 77 to 98 on mobile. PageSpeed Insights did the same in public: the services page scored 80, and the home page, from the same deploy, scored 100 five minutes earlier. Desktop sat at 99 or 100 throughout.

The slow runs had one thing in common. Lighthouse records an unthrottled trace before it simulates a slow phone, and in that trace the page had finished loading at 666 ms and painted nothing until 2,524 ms. The stalled runs we inspected all painted at around 1.5 or 2.5 seconds.

The usual suspects were all innocent

A late first paint usually means something on the page is holding it back, so that is where we looked. We removed the scroll animations, then the header animation, then the hero's entrance. We blocked the analytics and Cloudflare scripts on the live site. We served the build with and without the live security headers. None of it explained the stall.

The hero was the best lead. On stalled runs the largest element PageSpeed recorded was the small logo text, not the headline, and the headline faded in from fully transparent. Chrome's paint metrics ignore transparent text, so we removed the fade and redeployed. Stalled runs went from three in six to three in six.

Two clues pointed away from the page entirely. The identical files, served locally, never stalled. And on Azure, the site's default azurestaticapps.net address stalled once in six loads, while the custom domain, which reached its first byte about 220 ms later, stalled on about half.

Faking the delay made it happen every time

If timing mattered, we could fake the timing. A local server that added 400 ms to the HTML and 150 ms to every other file reproduced the stall on six runs out of six. From there each test took a minute instead of a deploy:

Test Runs that stalled
Live site, Lighthouse mobile about half
Live site, Lighthouse desktop, or mobile with screen emulation off 0 of 12
Live site, plain headless Chrome with the same phone settings 0 of 40
Local copy with the added delays, Lighthouse mobile 6 of 6
One heading, waiting on an empty, delayed stylesheet 3 of 3
One heading, waiting on a preloaded font 3 of 3
One heading, waiting on a delayed image 0 of 3

Stripping the real page changed nothing either: no scripts, no images, even every CSS rule deleted with the stylesheet still linked. It stalled anyway.

The one-heading page is the result that matters. No framework, no JavaScript, no animation: a heading and an empty stylesheet that arrives late, and Lighthouse's emulated phone still held back the first paint. A late image did not trigger it, which fits, because browsers paint text without waiting for images. The stall needs two things together: a first paint that waits on a render-blocking resource, and Lighthouse's mobile emulation.

Two settings fixed it, and neither is free

If the trigger is a first paint waiting on a stylesheet or a preloaded font, the fix is to stop it waiting on either. The site is built with Next.js, so that came down to two settings:

// next.config.ts
experimental: { inlineCss: true },

// layout.tsx, on each next/font call
preload: false,

With the CSS inside the HTML there is no stylesheet to wait for. Without the preloads, the browser paints text in a fallback font and swaps the web font in when it arrives. Afterwards the home page went from three stalled runs in six (scoring 78 to 97) to none (97 to 100), and services from four in six to none, at 100 every time. PageSpeed gave 99, 99 and 100 on mobile for home, services and products.

The costs are real:

  • Every page is about 13 KB heavier after compression, and the CSS is no longer cached from one page to the next.
  • Text appears first in a fallback font. On one page the swap now causes a layout shift of 0.097 in PageSpeed's tests, just inside Google's 0.1 threshold for good.

That trades real-world efficiency for a steadier lab score, and on most sites we would not make that trade. We made it here because, at the time, PageSpeed had no real-visitor data for this site at all, so the lab score was the only performance number anyone could look up. A consultancy that sells technical work is exactly the kind of site people check.

We know where it happens, not why

We did not trace this into Chrome's or Lighthouse's source. The habit of landing on 1.5 or 2.5 seconds suggests something that ticks once a second, but that is a guess, not a finding.

Nor can we prove that real phones never see it. Plain Chrome with the same phone settings never stalled in 40 loads, which is reassuring rather than conclusive. What we can say is that Google describes the Core Web Vitals it uses in Search as metrics that measure real-world user experience. A lab stall, on its own, is not what ranks you.

The fix may also age. It rests on how one version of Lighthouse behaves (we tested with 13.5), and a later release could stop stalling, or stall on something else.

Five runs will tell you if this is yours

If your mobile score moves while your code doesn't, check before changing anything. Lighthouse's own guidance is to run it several times and use the median, and never to run tests in parallel on one machine. So run five, one after another:

for i in 1 2 3 4 5; do
  npx lighthouse https://www.example.com/ --only-categories=performance \
    --output=json --output-path=run-$i.json --quiet \
    --chrome-flags="--headless=new"
done

for f in run-*.json; do
  jq -r '[.categories.performance.score * 100,
    (.audits.metrics.details.items[0] |
      .observedLoad, .observedFirstContentfulPaint)] | @tsv' "$f"
done

That prints, for each run, the score, when the page finished loading and when it first painted, in milliseconds. The pattern to look for is a first paint well after the load on some runs and not on others. If you see it, run the same five again with --screenEmulation.disabled added. If the stall disappears, it is the emulation, not your page.

Then look at the real-visitor section of your PageSpeed report, which comes from the Chrome UX Report once a site has enough traffic. If those numbers are good, you can reasonably leave the lab score alone. If you need it steady anyway, inline your CSS, stop preloading fonts, and accept the extra bytes.

  • Web performance
  • Lighthouse
  • Next.js

Need a hand with this in practice?

Reading about it is one thing. If you want someone to actually do it, that is what we are for.