Hello, I'm Elina. I'm a front-end developer at PhysicsX. I'll show you today a production application experiment where I swapped state management libraries and measured their performance.
The question is, does the library choice significantly affect performance, or are the differences small enough that we should prioritize other parameters? I choose one of our applications for experiments. Optimizer is our engineering tool for running and exploring optimization jobs. It connects to our internal compute and AI libraries, so we can define objectives, constraints, parameters, run experiments, and analyze the results all in one place.
Where does all this data for visualization come from? As input, we have a sample with metrics, parameters, and geometry. As output, we get a lot of candidates. At each step of an optimization job, we can have thousands of candidates, and there can be thousands of steps. We store all this data in a database and send it to the web via REST API to inspect in different ways. There is a lot of data, so I'm always working on visualizing it clearly in a faster way. In reality, it looks like this. Data-heavy UI, quiz tables, charts, live updates, and 3D. We built this up last year, and we used Recoil for state management. It was fast, simple, and allowed until this year. Unfortunately, Recoil were archived, so we have to move.
But how do we decide what to switch to? First idea, Jotai. Similar models, easy migrations from atoms and selectors to atoms and derived atoms. Minimal code changes. We also use Redux Toolkit in another app, so the team knows, and it has a strong ecosystem and predictable flow. Zustand is lightweight with direct updates and simple selectors. MobX gives reactive states and computed values with granular subscriptions. In short, we had zero realistic paths. So now here the state management libraries I will compare. Zustand, small global store with direct updates, Redux Toolkit, centralized store with action-reducer flow, Recoil, atom-based state with selector, Jotai, atom-based state with derived data, MobX reactive state that autosyncs with UI. All of them have different internals, different designs, and different costs when they're up and released. But the question is, does this difference actually matter in real app? I use same app, same pages, same components, same data sets, same UI interactions. I only swap state management integrations. No architecture rewrite. And because this app was originally written for Recoil, other libraries may encounter patterns that are not perfect for them.
Comments