Skip to main content

How to Optimize LCP Without Guessing What Is Slow

A more serious way to improve Largest Contentful Paint without randomly compressing whatever file is nearby.

Andrews Ribeiro

Andrews Ribeiro

Founder & Engineer

Track

Senior Frontend Interview Trail

Step 12 / 15

The problem

Bad LCP often produces bad advice.

The page feels slow and the usual sequence appears right away:

  • compress the image
  • split the bundle more
  • change the framework
  • add a CDN

Some of those may help.

But doing all of them without understanding the path until the main content appears is just an expensive form of guessing.

Mental model

LCP does not measure “how heavy your page is.”

It measures how long it took for the main visible content to appear.

So the right question is:

What needs to happen for that element to exist on screen?

That chain usually involves:

  1. the initial response
  2. discovery of the resource
  3. download of the main resource
  4. the CSS and rendering needed for it
  5. enough free CPU to paint it

If one of those stages is delayed, LCP suffers.

Breaking the problem down

First discover which element is the LCP

Without that, everything else becomes guessing.

It could be:

  • the hero image
  • a large block of text
  • the main banner

If you are optimizing a resource that is not even part of the LCP, you are spending energy in the wrong place.

Then map the path until it appears

Ask:

  • is this element already in the initial HTML or does it depend on JS?
  • was the resource discovered early?
  • was it downloaded with the right priority?
  • did CSS block rendering?
  • was the main thread too busy to paint?

That decomposition quickly separates what is network, what is rendering, and what is CPU.

Common causes of bad LCP

The main resource is discovered late

The browser does not even start downloading what matters early enough.

This happens when:

  • the image appears only after JS builds the tree
  • the HTML delays discovery
  • the resource priority is wrong

The resource itself is too heavy

This is the most obvious case.

A large image, bad format, dimensions bigger than needed.

But even here it helps to be careful.

Sometimes the problem is not only raw weight.

It is that a resource that matters was downloaded late when it could have been prioritized earlier.

CSS or fonts block the visual result

The main resource arrived, but the browser still cannot display it correctly.

Then things like these matter:

  • delayed critical CSS
  • fonts changing layout
  • style dependencies that push paint later

The main thread is busy

This is the least intuitive case for many people.

The resource is ready, but the browser is still processing too much JavaScript, hydrating interface, or doing expensive work before paint.

Simple example

Imagine a marketing page with:

  • a high-resolution hero image
  • a carousel assembled by JS
  • large CSS loaded early
  • tracking scripts before the main resource

The team says:

“The problem is the image.”

Maybe it is.

But the better read is:

  • does the hero appear only after JS builds the component?
  • does the browser discover that image early?
  • is the download priority correct?
  • does the needed CSS arrive first?
  • is the main thread stuck on third-party script?

Notice how the question changes.

You move from “which file should I compress?” to “which stage is delaying the main element?”

Common mistakes

  • Assuming bad LCP is always the image’s fault.
  • Not identifying which element is being measured.
  • Optimizing bundles without knowing whether the bottleneck is network or rendering.
  • Loading a critical resource late because of how the component is assembled.
  • Trying to fix LCP with generic checklist advice.

How a senior thinks about it

People who think better about this problem usually follow the critical path calmly.

Something like:

  • what is the LCP element?
  • when is it discovered?
  • does the resource come early or late?
  • can the browser paint as soon as it arrives?
  • is there enough CPU left for that?

That order matters because it avoids trading a convenient explanation for a correct one.

Seniority here is isolating the dominant bottleneck instead of spreading cosmetic optimizations across the app.

What the interviewer wants to see

They want to see whether you:

  • understand that LCP is about the main visible content
  • know how to break down the critical path for that content
  • can propose investigation before proposing medicine
  • distinguish discovery delay, network delay, and render/CPU delay

If your answer sounds like “first I would identify the LCP element and break down the path until it appears,” you are already ahead of a lot of memorized answers.

LCP improves when the main content arrives earlier and can appear earlier.

Mature work is not listing tips. It is discovering which stage is holding the screen back.

Quick summary

What to keep in your head

Practice checklist

Use this when you answer

You finished this article

Part of the track: Senior Frontend Interview Trail (12/15)

Next article Rendering, Network, and CPU Previous article Where the Bottleneck Is

Keep exploring

Related articles