Huge performance issue when dispatching hundreds of actions
See original GitHub issueOn boot, the app I’m building gets a stream of data from a server. This stream can have hundreds of messages and entities and each message is handled separately.
It takes a tremendous amount of time to dispatch actions after UI has rendered, because every state change re-renders the @connect
ed component.
I wrote a short example that shows dispatching 1000 actions before render (5-15ms) and 500 after render (~2.5s). So this is clearly not a redux issue.
https://jsbin.com/ruziwa/edit?js,console,output
Obviously component doesn’t need to re-render every single dispatched action, but re-rendering should be throttled (say, every 50ms). Is there an established approach for that or does it need to be integrated in @connect
?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:10
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Redux FAQ: Performance
Will dispatching many actions take up memory? Further information. Will caching remote data cause memory problems? Further information ...
Read more >How is performance affected by the dispatching of numerous ...
Normally React batches in event handlers and effects, but not in async code. You can manually control this by using the batch api...
Read more >React Redux: performance considerations when dispatching ...
In a React Redux app, what happens when you dispatch multiple actions in a row? When used out of the box without any...
Read more >3 small tips for better Redux performance in a React app
3. Batch actions to reduce # of renders ... Whenever you have to chain multiple actions one after the other (which you intentionally...
Read more >Redux FAQ: Performance
Will dispatching many actions take up memory? ... support dispatching arrays · React Redux #263: Huge performance issue when dispatching hundreds of actions....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, adding
really boosts performance.
Updated https://jsbin.com/ruziwa/11/edit?js,console,output
Probably messing with React’s methods is not the right approach though.
Yeah that will break sooner or later…
pseudo code