This way the cached elements can be shown until the new tree elements are created and you can just react setState to the new elements and it's instant
Maybe that's the real problem? If at all possible, such intensive tasks should be done in native frameworks, not web technologies. Alternatively, why not simply do less? Pagination, extracting separate sections of the app into separate pages/views and many others are perfectly valid approaches to something like that in my eyes, not just turning to low level optimizations.
To use the words of a commenter in another thread: I didn't provide sufficient information for informed responses. It was just a general comment about why I'm excited for React 18 to help better manage concurrency in a number of ways.
Picture a canvas that I'm calculating then drawing tens of thousands of elements to before displaying it. Very binnable. Very hard to get right to a point that you can't "feel" the lag when working with the rest of the app.
I also explored web workers but it's currently more hassle than I want to be bothered with.
You could try switching to Preact which has better performance and should be painless.
https://krausest.github.io/js-framework-benchmark/current.ht...
I appreciate the advice but I didn't provide sufficient information for informed responses. It was just a general comment about why I'm excited for React 18 to help better manage concurrency in a number of ways.
Suspense will also be nice because I can eliminate a lot of my own "loading screen" logic.