-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cost of immutability #328
Comments
Well, Om apps work exactly like this and don't seem to have these kinds of problems. When you want to squeeze additional bits of performance, you can use Immutable or Mori which, unless I am mistaken, better utilize memory by implementing persistent data structures using structural sharing. Finally, nothing per se prevents you from mutating your Redux state tree. It is actively discouraged, and you will lose a lot of debugging benefits if you mutate your data, but for performance critical pieces you can write impure reducers that mutate the state in place. (Only do that if you're sure that's where the lag comes from—not likely to be an issue in real apps.) |
Don't forget that even with traditional Flux you're still likely to allocate objects in your store getters or in your components' |
Thanks for your response. It could very well be a more generic react/flux question (I'm new to both). Thanks for addressing it anyway. I'm only planning on building a traditional web app for now, but who knows, might want to create a web version of After Effects one day... |
This is exactly the same concern as mine. Thanks for the explanation. |
@gaearon just looked into redux.js.org - 3 principles and there:
like some kind of misconception --- because as far as I understand mutating state is very discouraged PS: morover than follows the third principle that contradicts the second haha))
So second principle says that you can mutate state. And third says that actually to make mutation you can use pure functions))) haha PPS: maybe it is better to replace all |
im excited about this project but worried that this technique of creating a new state object on every change to the store would tax the gc and performance in a large application. Would be good to see some tests or explanations about why I shouldn't be worried about this
The text was updated successfully, but these errors were encountered: