LCP P75 of 14.5 s on a static site: what Cloudflare RUM pointed at, and the one-template fix
On 30 November 2026 I opened Cloudflare Web Analytics for my small static shop site and saw this in Core Web Vitals: LCP P75 14,480 ms, 33% poor. The site is plain HTML on Cloudflare Pages with a tiny stylesheet. TTFB wa
On 30 November 2026 I opened Cloudflare Web Analytics for my small static shop site and saw this in Core Web Vitals: LCP P75 14,480 ms, 33% poor. The site is plain HTML on Cloudflare Pages with a tiny stylesheet. TTFB was fine. So what was taking 14 seconds?
The short answer: seven product cover images, loaded eagerly, at roughly 3x the pixel width they were displayed at. Here is how I found it, what I changed, and the numbers before and after.
First, be honest about the sample size
The 14,480 ms figure came from 15 RUM samples. Six of those were ChromeHeadless, which was my own scripted checks, not people. The real slow ones were Android Chrome (14.48 s), iOS Safari (14.52 s) and Mac Chrome (15.1 s). A Windows Chrome sample was 3.3 s.
So the P75 is not a precise number. With 15 samples, one or two slow phones move it a lot. But every poor sample had the same page and the same LCP element, and that pattern was worth acting on. Before you trust a P75, check how many samples it has and which browsers they came from.
How to read the LCP element selector in Cloudflare RUM
Cloudflare Web Analytics records which element was the Largest Contentful Paint for each page view. I pulled it through the GraphQL Analytics API, from the rumWebVitalsEventsAdaptiveGroups dataset with the largestContentfulPaintElement dimension, next to the TTFB and FCP quantiles. The value is a CSS selector. Mine was:
#shop>div.grid.products>article.card>a>img
How to read it:
-
Read it from left to right, as a path from the root. It starts at the nearest ancestor with an
id(#shop), and each>is one step down to a direct child. -
tag.classnames the element and its class.div.grid.productsis adivwith both classesgridandproducts.article.cardis one product card. -
It does not say which card. There is no
:nth-child, so any of the seven cards matches. In practice the LCP is almost always the first one in the viewport. Lighthouse confirmed it was the first cover image,images/japan-cover.jpg. -
The last part tells you the kind of problem.
imgmeans an image download problem. If it ends inh1orp, the LCP is text, and you should look at fonts, CSS and TTFB instead. On my other pages the LCP was text at 0.4 to 1.3 s. - Compare it with TTFB and FCP. My TTFB P75 was at most 0.16 s and FCP at most 0.96 s. When the first paint is fast and the LCP is slow, the server, CSS and fonts are not the bottleneck. The browser is waiting for the LCP resource itself.
- Group by page path and element. All poor samples were "/" with that same selector. One page and one element means one fix.
The root cause
The seven covers were JPEGs, six of them 1600x1200, about 1.3 MB in total and roughly 83% of the page's weight. On screen they sit in slots no wider than 544 px. All of them loaded eagerly with no priority hint, so on a phone the first cover competed for bandwidth with the six below it and with 155 KB of web fonts.
The fix
I kept the JPEG URLs (the product pages and Open Graph tags use them) and wrapped each card image in <picture> with WebP sources at 800 and 1200 px wide:
<picture>
<source type="image/webp"
srcset="images/japan-cover-800.webp 800w, images/japan-cover-1200.webp 1200w"
sizes="(max-width: 860px) calc(100vw - 40px), 544px">
<img src="images/japan-cover.jpg" alt="Japan Trip Planner 2027"
width="800" height="600" fetchpriority="high" decoding="async">
</picture>
The rules per card:
-
Card 1:
fetchpriority="high", because it is the LCP element. - Card 2: no hint. It is in the first row on desktop.
-
Cards 3 to 7:
loading="lazy". -
All cards:
decoding="async", andwidth/heightstay, so there is no layout shift.
The site is generated by a small Python script, so this was a change to one template function: build the srcset, then pick the hint from the card index (fetchpriority for index 0, loading="lazy" for index 2 and up). CSS, fonts and JS did not change.
Making the WebP sizes with Pillow
Each WebP at 800 w came out at 27 to 37 KB, compared with 62 to 280 KB for the original JPEGs. This is the script, using quality 78 and method 6 (the slowest and smallest encoder setting). I tested it with Pillow 13. It reproduced my deployed files byte for byte.
from pathlib import Path
from PIL import Image
WIDTHS = (800, 1200)
def make_webp(src, widths=WIDTHS, quality=78):
src = Path(src)
with Image.open(src) as im:
im = im.convert("RGB")
for w in widths:
if w > im.width:
continue # never upscale
h = round(im.height * w / im.width)
out = src.with_name(f"{src.stem}-{w}.webp")
im.resize((w, h), Image.LANCZOS).save(out, "WEBP", quality=quality, method=6)
print(out, f"{w}x{h}", out.stat().st_size, "bytes")
for p in Path(".").glob("*-cover.jpg"):
make_webp(p)
The w > im.width check matters. One of my covers is already 800 px wide, so it gets only an 800 w file, and its srcset lists only that one.
Results
Lighthouse 13.6 on a local static server, 3 runs for each setting. The runs were identical.
| Before | After | |
|---|---|---|
| Mobile LCP | 8.78 s | 2.78 s |
| Mobile performance score | 0.75 | 0.96 |
| Page weight (mobile) | 1,463 KiB | 353 KiB |
| Desktop LCP | 1.54 s | 0.60 s |
| Desktop performance score | 0.95 | 1.00 |
| CLS | 0 | 0 |
Note that Lighthouse's 8.78 s is not RUM's 14.48 s. Lighthouse simulates one throttled phone. RUM is whatever real devices and networks your visitors have. Use the RUM selector to find what is slow, and use Lighthouse to check whether your change helped, run by run.
The change went live today. I added a small curl script that checks the deployed HTML has 7 <picture> elements, one fetchpriority="high", 5 lazy images, and that each WebP returns 200 with image/webp. It passed 34 of 34 checks. The real test is the RUM P75 next week, with ChromeHeadless samples excluded.
What I'd check first next time
- Is the LCP element an
img? Then compare its natural size with its display size before you touch fonts or caching. - Is the first image eager and high priority, and is everything below the first row lazy?
- How many RUM samples, and how many are your own bots?
Next on my list: the product pages still load full-size covers, and both web fonts are preloaded on every page.
The site, if you want to check its LCP yourself: https://hodoyoku.pages.dev/
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.