UI5 Web Components · Table · Cahit Gürgüc

100,000 rows.
120 frames per second.
Any framework.

How the new table virtualizer keeps huge tables smooth – even when every row has a different height.

Press → / PgDn or scroll

Today

From “why is my table slow?” to 120 FPS

The problem

Why big tables are slow, and why rows of different heights make it hard.

The ideas

Guessing, a clever tree, keeping your place, and not fighting your finger.

Your part

What an app has to do – with React, Angular or plain JavaScript.

Results

What we measured, what we rejected, and how you can try it.

The problem

Every row costs work

A table row is not one thing. It is a row element, cells, texts, tags, buttons – and each of them has its own small inner structure.

The browser has to create, style, lay out and paint every single one of them.

One row of our demo table: ≈58 elements.
100,000 rows: ≈5.8 million elements.

Try it on your phone: the buttons build simple rows (much lighter than real table rows) and measure the time on your device.

1 table row
… is really

Measured live on this device.

The classic trick

Render only what you can see

A screen shows maybe 10–20 rows. So we only create those – plus a few extra above and below.

While you scroll, rows that leave the screen are removed or reused for the rows that come in.

This is called virtualization: the table pretends to have 100,000 rows.

Data
Screen
Rows in the data: 100,000 Row elements in the page: 12 First visible: 0

How it used to work

If every row is 50 px tall, it’s simple math

Which row is at the top of the screen? Divide the scroll position by the row height.

first row = ⌊ scrollTop ÷ 50 ⌋

Our previous virtualizer worked exactly like this. It needed one fixed rowHeight for all rows.

scrollTop0
÷ row height50 px
= first row0

Always right – because every row has exactly the same height.

The real world

Real rows are not equal

📝 Text wraps 🔽 Details expanded 🖼 Images load later ↔ Columns resized 📱 Phone rotated

Now the simple formula points to the wrong row. And heights keep changing while you look at them, so the content jumps.

We have to know where every row starts – without ever having seen most of them.

formula
scrollTop0
Formula saysrow 0
Really visiblerow 0
Off by0 rows

The time limit

8.33 milliseconds

A 120 Hz display shows a new picture 120 times per second. For each picture, the browser has 8.33 ms for everything: our code, styles, layout, painting.

If one frame takes too long, the display shows the old picture again. You see that as stutter.

So all of the following ideas have to be fast – not just correct.

JavaScript Style Layout Paint Composite

Illustration. Measured: the virtualizer’s own work is about 0.1 ms per frame – even with a CPU slowed down 4×.

Idea 1

Guess what you haven’t seen

Rows we have never rendered get an estimated height: the average of all rows we have measured so far. Before the first measurement, the app can give a hint (estimatedRowHeight).

Every rendered row is measured and replaces its guess with the truth.

We only update the guess when we have measured twice as many rows as last time – so the scrollbar does not twitch with every new row.

Measured rows0
Average of measured–
Guess for all others80 px
Next guess update at1 measured
Total height of 100,000 rows8.0 M px

Idea 2 · the cool part

Where does row 70,000 start? – in 17 steps

To place a row we need the sum of all heights above it. Adding them one by one means up to 100,000 additions – in every frame.

Instead, we keep a small tree of partial sums (a Fenwick tree). Each box knows the total height of a block of rows. Any sum needs only a few boxes:

  • Where does row i start? Add at most 17 boxes.
  • A row changed its height? Update at most 17 boxes.
  • Which row is at pixel y? Walk down the tree: 17 decisions.

17 because 217 = 131,072 ≥ 100,000. With 1 million rows: 20 steps.

16 rows, each with its height
One by one
–
additions
With the tree
–
boxes

Idea 2, continued

Two trees and one guess

Most rows are never measured. We don’t store a guess for each of them. Instead we keep two trees:

  • Tree 1: sum of the measured heights
  • Tree 2: how many rows are measured
start(i) = measuredSum(i) + (i − measuredCount(i)) × guess

When the guess changes, nothing has to be updated – it is just one number in the formula.

Rows 1–13: solid = measured, striped = guessed
Adding one by oneOur trees
Where does row i start?up to 100,000 steps≤ 17 steps
Which row is at y?up to 100,000 steps≤ 17 steps
One row changed its heightshift all rows below≤ 17 steps
The guess changedupdate every guessed row1 step
Memory per row: 17 bytes → 100,000 rows = 1.7 MB
height 4 B 1 tree 1: 8 B tree 2: 4 B

Idea 3

Let the browser tell us the sizes

Asking “how tall is this row?” right after changing something forces the browser to calculate the layout immediately – again and again.

Instead we use a ResizeObserver: the browser does its layout once and then reports the sizes of all rows together.

Bonus: it also tells us when a row grows later – an image arrives, text rewraps, the phone rotates.

Ask immediately
 
Let the browser report (ResizeObserver)
 
update a row read its height full layout sizes delivered

Idea 4

Keep the row you are reading still

A row above you grows – maybe its data just arrived. Without care, everything below is pushed down and you lose your place.

We pick one row as the anchor and keep it exactly where it is. Which one?

  1. The row you jumped to
  2. The row with the keyboard focus
  3. The first row you can read (not a loading placeholder)
Without anchoring
With anchoring

👁 = the row you are reading. A row above it grows by 80 px.

Idea 5

Never stop a scrolling finger

The obvious way to keep your place is to correct the scroll position. But on phones and trackpads, changing the scroll position can stop momentum scrolling.

So we don’t touch it. We collect all corrections in one number – the drift – and move only the rows.

When scrolling stops, we hand the drift back to the scroll position. Rows and scroll position move together, so you see nothing.

Correct scroll position
Drift
drift
0 px

The graphs show the scroll speed. A row above the screen grows by 120 px during momentum scrolling.

Idea 6

Move one block, not every row

In our table, all rows share one grid, so a long text in one row widens the column for every row. That’s why the columns line up.

Positioning each row on its own pulls it out of the shared grid – every row sizes its columns differently.

So the visible rows stay in the grid, and we move them together as one block with a single translateY.

LayoutPaintComposite (GPU)

Moving a block this way skips layout and painting. CSS tricks that skip off-screen content would also isolate each row from the grid – and we have no off-screen rows anyway.

Each row on its owncolumns broken
One blockcolumns aligned

Idea 7

Taller than the browser allows

1,000,000 rows × 150 px = 150 million pixels. Browsers have a maximum element height – in Firefox about 18 million px.

So the scroll area never gets taller than 16 million px (tested in Chrome, Firefox and Safari):

  • Dragging the scrollbar: 50% of the scrollbar = 50% of the data.
  • Wheel, touch, keyboard: still exactly 1 pixel per pixel – it feels completely normal.
Your data
row 0
Scroll area
16,000,000 px

Left: 150,000,000 px of rows. Right: the 16,000,000 px the browser actually scrolls (same scale).

Works with any framework

The table asks. Your app renders.

range-change { first: 120, last: 135 } → Your app · React, Angular, Vue, plain JS → rows 120–134 with position

The table never creates rows itself – frameworks want to own their elements. How your app reuses its row elements is up to you:

Keyed – like React key
Positional – rewrite all
Pool – park & reuse

Colors = element identity. Scrolling by 2 rows: keyed creates 2 and deletes 2, positional rewrites all, pool reuses 2.

For app developers

What you need to do: three things

1Listen

to the range-change event of ui5-table-virtualizer.

2Render

rows first to last−1, in order, each with its position.

3Flag

rows whose data is still loading with loading – keep the cells, empty is fine. The table draws the placeholder.

function Orders({ orders }) {
  const [range, setRange] = useState({ first: 0, last: 0 });
  const rows = [];
  for (let i = range.first; i < range.last; i++) {
    const order = orders.get(i);  // undefined while loading
    rows.push(
      <TableRow key={i} position={i} loading={!order}>
        <TableCell>{order?.id}</TableCell>
        <TableCell>{order?.text}</TableCell>
      </TableRow>
    );
  }
  return (
    <Table>
      <TableVirtualizer slot="features" rowCount={orders.size}
        onRangeChange={e => setRange(e.detail)} />
      <TableHeaderRow slot="headerRow">…</TableHeaderRow>
      {rows}
    </Table>
  );
}

What you don’t need to do

  • Know or calculate row heights
  • Any scroll math or scrollbar tricks
  • Keyboard and focus handling
  • Design loading placeholders
  • Keep track of which rows were measured

Built in

Placeholders while data loads

Data often comes from a server. Until it arrives, a row only needs loading. The table takes care of the rest:

  • Loading rows show placeholders in theme colors
  • Height = the current guess, so fewer jumps when real data replaces it
  • Placeholder heights never spoil the guess
  • The row you read stays still when the data arrives
  • Very fast flings show a placeholder pattern instead of white space

The server answers after 1.2 s. The marked row keeps its position.

Accessibility

Focus is a number, not an element

Hold Page Down: the next target row usually does not exist yet. Most virtual lists lose the focus right here.

We remember the focus as a row number. Each key press is calculated from the guessed heights, so even a page of very different heights is one screen. The focus waits in the table until the row is there.

No key press is lost – even when the app renders late.

PgDn
Key presses0
Focus targetrow 0
Focus is onrow 0
Lost key presses0

The app needs 400 ms to render new rows.

Just as important

Ideas we tried, and why we rejected them

Build our own scrolling

Why not

Custom scroll physics never feels native. It breaks accessibility, find-in-page and scrolling inside the page.

Position every row on its own

Why not

Rows leave the shared grid, so columns stop lining up.

Correct the scroll position right away

Why not

Can stop momentum scrolling on phones and trackpads. The drift solves it.

The table renders the rows

Why not

React and Angular want to own their elements. Two owners fight.

Read each height right after rendering

Why not

Forces a full layout for every row. The browser reports sizes for free.

CSS that skips off-screen content

Why not

Isolates rows from the grid. And there is nothing off-screen to skip.

Add all heights every time

Why not

100,000 additions per frame. The tree needs 17.

Remember only a few hundred heights

Why not

Positions jump when you scroll back. 1.7 MB for 100,000 rows is cheap.

Measured, not promised

Results

0
FPS while auto-scrolling 12,000 px/s
0
frames with white space
0
lost key presses (58 presses, app 50 ms late)
0
steps to find any of 100,000 rows
Scenario (5 s auto-scroll)FPSFrame time p95White spaceContent jumps
10,000 rows, 4,000 px/s1209.3 ms00
10,000 rows, 12,000 px/s1209.0 ms00
Scrolling up into never-seen rows1209.3 ms00
100,000 rows (15 M px of content)1209.2 ms01 × 1.3 px
Data arrives after 400 ms (placeholders)1209.3 ms00

Chrome 150, macOS, 12 cores, 120 Hz display. Automated scrolling. “Content jumps” = the row you read moved by more than 1 px.

Open the live demo here

Thank you!

Try it. Break it.
Tell us.

Scan the code and try the demo on your phone: fling, rotate, switch the data size to 1,000,000 rows. We’d love your feedback – especially what feels wrong.

  • Variable row heights, no configuration
  • Native scrolling, 120 FPS
  • Any framework: the app owns its rows
  • Keyboard and placeholders built in