Yesterday I turned JavaScript off on all 38 pages of our site and found that the only content it costs us is 876 characters of FAQ answers on notifio.app/help. That measured the case where the script never arrives.
This is the case that actually happens: the script does arrive, and the reader is looking at the question before it does. I wanted the length of that window, and the honest version of why it exists.
The method
Playwright, the page loaded with waitUntil: "commit" so the clock starts at the first byte, and then a loop in the page that clicks the first FAQ button every 50 ms and checks whether the document got longer. The first click that grows the text is hydration landing. Chrome DevTools Protocol provides the throttling:
await client.send('Network.emulateNetworkConditions', {
offline: false, latency: 400,
downloadThroughput: 1600 * 1024 / 8, uploadThroughput: 750 * 1024 / 8,
});
await client.send('Emulation.setCPUThrottlingRate', { rate: 4 });
1.6 Mbps down, 400 ms of round trip, and a processor four times slower than the one on my desk. That is not a cruel profile. It is a phone on a train.
The numbers
Three runs of each, and the run to run spread was under 10 ms every time:
my desk throttled
TTFB 40 to 57 ms 44 to 50 ms
first paint 172 to 208 ms 1,412 to 1,452 ms
first click that works 176 to 178 ms 2,682 to 2,690 ms
dead window none measurable 1,234 to 1,254 ms
On my desk the FAQ works at the same moment the page appears, within the noise of the two measurements, which is why I had never noticed this. On the throttled profile the question is readable at 1.44 seconds and clickable at 2.69. For a second and a quarter the page is a list of six questions that do nothing.
The answers are not hidden in that window, they are absent. The accordion unmounts its answers rather than collapsing them, which is a choice we made on exactly one page out of thirty, so there is no HTML for the browser to reveal and no way for the reader to get at the text early.
I assumed it was CPU, and it is not
My guess before measuring was that the 1 MB of JavaScript on these pages was being parsed and executed on a slow processor while the reader sat there. So I collected long tasks and total blocking time on the same throttled profile:
page FCP load long tasks longest TBT
/help 1,436 3,044 2 89 ms 49 ms
/terms 1,168 3,336 1 88 ms 38 ms
/alerts/kamernet 1,168 3,322 1 89 ms 39 ms
/ (home) 1,208 3,372 2 88 ms 47 ms
Forty-nine milliseconds of blocking time. Two long tasks, neither reaching 90 ms. The main thread is not the problem, and at 4x CPU throttling I would have expected it to be.
What fills the window is transfer. The page's eight script chunks are 1,007,990 bytes raw and 318,056 over the wire, and at 1.6 Mbps that is about 1.6 seconds of pure download, which lines up with the gap. React cannot attach a click handler to a button whose component has not been downloaded, however fast the processor is.
That changes which fix is the right one. Shaving parse work would buy 49 ms. Shaving bytes is the only thing that moves the window, and the biggest two chunks on that page are the error reporter at 145 KB over the wire and an animation library at 53 KB that is there for one sliding word in the footer.
The other 28 pages
The table above is the part I keep rereading. notifio.app/terms and notifio.app/alerts/kamernet have no buttons on them at all. No accordion, no form, nothing a reader can press. They still download the same eight chunks, still take until 3.3 seconds to reach load, and still spend 38 to 39 milliseconds of blocking time hydrating a document whose every interactive element is a plain anchor.
Hydration on those pages is not buying responsiveness, because there is nothing to respond. It is buying a scroll effect in the nav and a wordmark that slides up in the footer.
What I would change, in order
- Put the FAQ answers in the HTML and collapse them with CSS. The window stops mattering, because the content is there from the first paint and the button becomes an enhancement rather than a gate. This also fixes the no-JS case from yesterday's post, and it is a few lines.
- Load the error reporter after the page is interactive rather than in the critical path. It is the single largest chunk and it is not needed to render a word.
- Replace the footer animation with CSS so that 28 text pages stop importing an animation library.
None of that changes TTFB, which is 44 to 50 ms throttled, because the HTML is prerendered and sits on a CDN. The server half of this site is not the slow part, and never was. The slow part is a second and a quarter in which we have painted a question and cannot answer it.
If you want to watch the window yourself, open notifio.app/help with your network throttled to Slow 4G in DevTools and click the first question as soon as you can read it. Nothing happens, once.
Top comments (0)