DEV Community

Ricardo Saumeth
Ricardo Saumeth

Posted on

๐—ง๐—ต๐—ฒ ๐Ÿฑ๐Ÿฌ๐—บ๐˜€ ๐—ฅ๐˜‚๐—น๐—ฒ: ๐—›๐—ผ๐˜„ ๐—ข๐—ฟ๐—ฑ๐—ฒ๐—ฟ ๐—•๐—ผ๐—ผ๐—ธ ๐—•๐—ฎ๐˜๐—ฐ๐—ต๐—ถ๐—ป๐—ด ๐—ฆ๐—ฎ๐˜ƒ๐—ฒ๐˜€ ๐—”๐—š ๐—š๐—ฟ๐—ถ๐—ฑ ๐—™๐—ฟ๐—ผ๐—บ ๐—ฃ๐—ฒ๐—ฟ๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐—ป๐—ฐ๐—ฒ ๐—›๐—ฒ๐—น๐—น

Why do trading dashboards freeze the moment markets get volatile?
I hit this exact wall building a realโ€‘time crypto app with AG Grid โ€” and the fix came down to one simple rule:

๐Ÿ‘‰ ๐—•๐—ฎ๐˜๐—ฐ๐—ต ๐˜‚๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ๐˜€ ๐—ฒ๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐Ÿฑ๐Ÿฌ๐—บ๐˜€.

๐—ง๐—ต๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ฏ๐—น๐—ฒ๐—บ
A live order book from the Bitfinex WebSocket API v2 can fire dozens of updates per second during volatility.
If you naรฏvely dispatch every message:
Redux fires constantly
React re-renders constantly
AG Grid tries to reconcile rows constantly
AG Grid is fast โ€” but not โ€œhundreds of DOM updates per secondโ€ fast.
The result:
โŒ frozen UI
โŒ dropped frames
โŒ a dashboard that feels like a slideshow

๐—ง๐—ต๐—ฒ ๐Ÿฑ๐Ÿฌ๐—บ๐˜€ ๐—ฅ๐˜‚๐—น๐—ฒ
Instead of dispatching every update, we buffer them and flush once every 50ms.
Thatโ€™s ~20 updates per second.
Smooth. Stable. Still โ€œrealโ€‘timeโ€ to the human eye.
ts
let buffer: BookUpdate[] = []

setInterval(() => {
if (buffer.length === 0) return
dispatch(bookBatchUpdateReducer(buffer))
buffer = []
}, 50)

AG Grid now processes one batch per cycle, not fifty individual transactions.
FPS stays high. The UI stays responsive.

๐—ช๐—ต๐˜† ๐Ÿฑ๐Ÿฌ๐—บ๐˜€?
Human perception of โ€œinstantโ€ is ~100ms.
At 50ms:
Feels realโ€‘time
Cuts render load by an order of magnitude
Avoids thrashing the grid
Go lower (10ms) โ†’ youโ€™re back to choking the main thread.
Go higher (200ms) โ†’ the order book feels sluggish.

๐Ÿฑ๐Ÿฌ๐—บ๐˜€ ๐—ถ๐˜€ ๐˜๐—ต๐—ฒ ๐˜€๐˜„๐—ฒ๐—ฒ๐˜ ๐˜€๐—ฝ๐—ผ๐˜.

๐—ง๐—ต๐—ฒ ๐—•๐—ฟ๐—ผ๐—ฎ๐—ฑ๐—ฒ๐—ฟ ๐—Ÿ๐—ฒ๐˜€๐˜€๐—ผ๐—ป
Highโ€‘frequency data doesnโ€™t care about your render budget.

๐—ฌ๐—ผ๐˜‚ ๐—ต๐—ฎ๐˜ƒ๐—ฒ ๐˜๐—ผ ๐—ฒ๐—ป๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ ๐—ผ๐—ป๐—ฒ.
Batching applies to:
live sports feeds
IoT telemetry
logistics tracking
any system where data outpaces UI capacity
AG Grid is powerful, but it still lives on the main thread. Respect that, and your UI will thank you.

Building this in my React 19 + Redux Toolkit crypto project taught me more about browser performance than any tutorial ever could.

What batching strategies have you used in highโ€‘frequency UIs?

Would love to hear your experiences.

๐—ช๐—ฟ๐—ถ๐˜๐˜๐—ฒ๐—ป ๐—ฏ๐˜† ๐—ฅ๐—ถ๐—ฐ๐—ฎ๐—ฟ๐—ฑ๐—ผ ๐—ฆ๐—ฎ๐˜‚๐—บ๐—ฒ๐˜๐—ต
๐—ฆ๐—ฒ๐—ป๐—ถ๐—ผ๐—ฟ ๐—™๐—ฟ๐—ผ๐—ป๐˜โ€‘๐—˜๐—ป๐—ฑ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ | ๐—ฅ๐—ฒ๐—ฎ๐—นโ€‘๐—ง๐—ถ๐—บ๐—ฒ ๐—จ๐—œ ๐—ฆ๐—ฝ๐—ฒ๐—ฐ๐—ถ๐—ฎ๐—น๐—ถ๐˜€๐˜

Top comments (0)