SquishPixel Blog · Web performance · Core Web Vitals · Tools

Font preloads delayed first paint by 3.7 seconds on a slow connection, a developer's tests show

According to DEV Community, a developer measured paint metrics on all 76 pages of their site at desk speed and got excellent results. Largest Contentful Paint (LCP, the time the biggest visible element appears) had a median of 160ms. The author then repeated the tests with throttled connections, using four speeds and six pages per profile.

On the slowest profile, a 400 kbps link, first paint took 9.2 seconds and the load event landed at 20.4 seconds. Each page transfers about 880 to 900 KB. The author says blocking the site's own font files made first paint arrive 3.7 seconds sooner, with text shown in Arial. Even without throttling, first paint on one page dropped from 460ms with fonts to 172ms without.

The cause is font preloads. A preload tells the browser a file will be needed soon, so it fetches it at high priority. The site's framework, next/font, emits a preload for each of ten font files, about 322 KB in total. On a slow link they compete with the 47 KB of HTML and 154 KB of CSS that first paint is waiting for.

The fonts also drove a layout shift. The large shift landed 783 milliseconds after the last font arrived, when the real font replaced the fallback. On one page it moved a contents panel up by 28 pixels. The author notes that the shift is invisible at desk speed but noticeable when it happens seconds into reading.

The author also flags two measurement traps. Time to first byte (TTFB) stayed near 29 milliseconds even on the slowest profile, because the throttling slows the response body, not the first header byte. And adding a performance observer before every page load in a loop stacked up copies of it, so layout shifts were counted many times over.

Why it matters

Speed figures taken on a fast office connection can hide real problems. A default that costs nothing on fibre, such as preloading every font, can become the slowest part of a page for visitors on weak connections. The author stresses that the site is quick overall and has no images or third-party embeds, so the lesson applies to any site that preloads many fonts.

The post is also a reminder to check how a test tool works before trusting its numbers. Throttled TTFB, for example, reflects only the server's first packet, and duplicated measurement scripts can inflate layout shift scores.

The author's fixes are to preload only the two faces the first screen needs, use font-display: optional for the heading font, and test at slow 4G going forward.

Source: DEV Community. This brief summarises their reporting; read the original for the full detail.