How we* made this site faster
Months ago, Craig Mod wrote about how fast software is the best software:
I love fast software. That is, software speedy both in function and interface. Software with minimal to no lag between wanting to activate or manipulate something and the thing happening. Lightness.
And I have been trying to make my software fast as well. Because fast is smooth. Smooth is good.
Recently, with Claude, we worked on making this website fast and made some significant improvements. The desktop seemed fine but we improved the Lighthouse mobile score from 92 to 98. Gears page was unoptimized as well so the score was around 71 and after the improvements we got 98.
| Metric | Before | After | Change |
|---|---|---|---|
| Score, homepage | 69 | 99 | +30 |
| Score, post | 61 | 97 | +36 |
| LCP, homepage | 5.9 s | 2.1 s | −3.8 s |
| LCP, post | 7.0 s | 2.3 s | −4.7 s |
| FCP, homepage | 3.5 s | 1.2 s | −2.3 s |
| FCP, post | 5.8 s | 1.4 s | −4.4 s |
| TBT, homepage / post | 120 / 120 ms | 4 / 40 ms | Better |
| Weight, homepage | 1.8 MB | 0.7 MB | −1.1 MB |
| Weight, post | 4.0 MB | 3.0 MB | −1.0 MB |
Most of the gain came from three things: fonts, images and the signup popup.
1. Fonts
The body text used Geist from Google Fonts. The browser had to get that font before it showed any text. Now the body text and the code text use the fonts that are already on the device.
The headings use Roslindale. The old font file was 592 KB. Claude made a smaller copy with only the letters that this site uses: Latin and Latin Extended-A. The new file is 287 KB. Why Latin Extended you may ask? Well, I like to use the accented variants where possible (like "ā" in "Nāvu").
2. Images
Many images were larger than the space they filled. The post header showed my photo at 72 px, but it loaded a 164 KB file. Now it loads a small WebP copy. We also changed all images to load WebP (except the home page cover where JPEG was smaller so we used that).
We also used fetchpriority="high" for first images so it loads at once with higher priority and loading="lazy" for images further down the pages so it only loads when you scroll near them.
For the home page with the cover image, we used ‹link rel="preload" as="image"> so when the page loads, the image is loaded preemptively.
With all these changes, the gears page got the largest gain. Its first row of images loaded late. Its largest image showed after 8.94 seconds. Now it shows after 2.19 seconds.
3. The signup popup
Ghost has a signup popup called Portal. Ghost loads it on every page, and it is 516 KB. We updated the theme so the site does not load Portal with the page.
A small script loads Portal when a reader needs it. For example:
- The reader points at, focuses or clicks a Subscribe button.
- The reader opens a
#/portallink. - The reader comes back from a sign-up email.
- The page has a sign-up form.
Without Portal, the largest image showed after 2.04 seconds, instead of the previous 4.80 seconds.
I am sure there might be tonnes of different areas where we could improve but in my view, this is a good start.