February 15 2025
Render Tree, Layout, Paint, and Reflow: What Causes Jank
How to understand the real cost of updating interface in the browser without treating everything as a React, CSS, or JavaScript problem in isolation.
Andrews Ribeiro
Founder & Engineer
4 min Intermediate Frontend
Track
Senior Frontend Interview Trail
Step 10 / 15
The problem
Some interfaces feel slow even when “nothing fully freezes.”
Scroll feels odd. Animation feels heavy. The click responds, but the screen stutters.
This kind of visual discomfort often gets a practical name:
jank
And it is tricky because many people try to explain it in the shortest possible way:
- “React re-rendered”
- “the CSS is heavy”
- “JavaScript blocked”
All three phrases may touch the problem.
But they still do not explain the full path.
Mental model
To design or debug UI in the browser, it helps to think in four layers:
- the browser understands the relevant visual structure
- it calculates sizes and positions
- it paints pixels
- it composes the result on screen
In more common language:
- render tree
- layout
- paint
- composition
Jank appears when that work becomes too expensive for the expected interaction pace.
Breaking the problem down
Render tree is not the full DOM in the abstract
The browser starts from structure and styles to understand what needs to participate in rendering.
Not every node enters in the same way.
What matters here is not memorizing exact implementation details.
It is understanding that there is a visual structure derived from what needs to appear.
Layout calculates geometry
Layout answers questions like:
- how big is this element?
- where does it sit?
- what changes around it when it grows?
When you change properties that affect geometry, the browser may need to recalculate that map.
That can cost a little or a lot.
It depends on how many elements and relationships enter the domino effect.
Paint draws the appearance
After geometry, the browser may need to repaint.
That includes things like:
- color
- shadow
- border
- text
- image
Not every repaint is terrible.
But frequent repainting over large areas also costs.
Reflow is the nickname for layout pain
In practical discussion, many people use reflow to talk about layout recalculation triggered by geometry changes.
Examples of changes that tend to be more sensitive:
- changing
width - changing
height - inserting content that pushes other elements
- reading a DOM measure after repeatedly writing styles
When you mix reading and writing layout without care, you can force the browser to recalculate more times than needed.
Simple example
Imagine an animated list.
A more expensive version:
- on every frame you change
topandheight - then read
offsetHeight - then write again
That cycle tends to force repeated layout work.
A cheaper version in many cases:
- move with
transform - avoid reading measures all the time
- group reads and writes
It is not that transform solves everything.
But it usually avoids some of the heaviest geometry work.
Common mistakes
- Blaming the framework without looking at the kind of visual change.
- Treating every repaint like the same catastrophe.
- Reading DOM measurements right after several writes without noticing the cost.
- Assuming only animation causes jank.
- Ignoring that JavaScript, layout, and paint all compete for the same smoothness window.
How a senior thinks about it
People with more experience usually look at jank and ask:
Is the bottleneck in JavaScript, in layout, in paint, or in the combination of them?
That question is strong because it avoids guessing.
Instead of optimizing in the dark, it pushes the investigation toward the expensive stage that actually matters.
What the interviewer wants to see
In interviews, this topic appears to test whether you understand the browser beyond the framework.
The evaluator wants to see whether you:
- distinguish layout from paint
- understand why some changes cost more
- connect jank to the main thread and rendering
- avoid simplifications like “rerender equals bug”
A strong answer often sounds like this:
Jank appears when the browser has to do too much visual work for the time window of the interaction. I would try to discover whether the cost is in JavaScript, in layout recalculation, in paint, or in a combination of them.
Smooth interfaces do not come from memorizing terms. They come from understanding that not every visual change charges the same bill.
Quick summary
What to keep in your head
- Jank appears when the main thread and the rendering pipeline cannot keep up with the expected interaction rhythm.
- Layout and reflow cost more when changes force the browser to recalculate geometry for many elements.
- Not every visual change costs the same. Some touch only composition, others force layout and paint.
- Understanding the visual pipeline helps more than blaming a framework by reflex.
Practice checklist
Use this when you answer
- Can I explain the difference between layout, paint, and composition in simple language?
- Do I know why reading and writing DOM measurements in sequence can make performance worse?
- Can I connect jank to main-thread work and not only to CSS?
- Can I point to examples of cheaper and more expensive visual changes?
You finished this article
Part of the track: Senior Frontend Interview Trail (10/15)
Share this page
Copy the link manually from the field below.