Menu

1 / 5

React INP Benchmark: Chunking vs startTransition vs scheduler.yield

DEV Community: react·Suprabhat Kumar·6 days ago
#cPIjVS6I
#devtoreact#devto#dev#work#yield
Reading 0:00
15s threshold

Originally published at suprabhat-dev.com .

A user clicks a button that starts heavy work: filtering a large list, scoring rows, building a search index. While that work runs on the main thread, the next click waits, because the browser cannot handle input or paint until the work returns. Interaction to Next Paint (INP) measures that wait, and in data-heavy React screens it is usually the Core Web Vital that fails first.

The common answers are startTransition , slicing the work with setTimeout , yielding with scheduler.yield() , or a library that does the slicing for you. I maintain one of those libraries, react-inp-chunker , so I wanted numbers rather than claims. This article walks through a small benchmark that runs the same work five ways and measures how long a click made during that work waits.

The setup

The workload scores 20,000 rows, with 30 rounds of string hashing per row, then sorts the results and shows the top 25. Every version does exactly the same work.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.