|
|
|
|
|
by guptagaruda
3202 days ago
|
|
It depends on the complexity of the application. If I am happy with the performance profile with mutable state then going with immutable state is obviously an overkill. These optimizations matter when React spends lot of time diffing the virtual dom of the entire app component for every state change. I don't have an example with mutable state but for React + Redux, click on the benchmark perf test page @ https://github.com/guptag/js-frameworks. With 1500 tickers added to the page and with an price update happening every 10ms, React/Redux updates the view within 5ms (on my machine) and consistently maintains 60fps. This is when React does the virtual diffing of only one ticker component whose state is changed and skipping the rest (because of React-Redux's immutability checks). It's going to take more time if React spends diffing the entire app for every update (unfortunately, I don't have a measurement with mutable state as I built this page to compare with AngularJS). We can easily measure and make a call whether immutability is needed for an app or not. |
|