Skip to content
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

Re-calculation when adding new item #380

Open
raRaRa opened this issue Oct 15, 2018 · 1 comment
Open

Re-calculation when adding new item #380

raRaRa opened this issue Oct 15, 2018 · 1 comment

Comments

@raRaRa
Copy link

raRaRa commented Oct 15, 2018

I'm using reselect to create various selectors for React + Redux. The problem I'm facing is that when I have over 500k items, the selector calculation might take from 500ms to 800ms, since it has to filter and sort through 500k items with complex checks. I could probably increase the performance further, but I wanted to ask a few questions first.

I'm using normalized state in Redux, where I have the items stored in byIds, and the ids in allIds. This is fine. However, when I add a new item, byIds and allIds will be updated, meaning that the selector will have to re-calculate all the 500k items again, instead of just running it for the new item.

Is there some smart way to solve this, or something I'm missing?

Thanks.

@raRaRa
Copy link
Author

raRaRa commented Oct 30, 2018

Here's my Stackoverflow question which better explains the issue: https://stackoverflow.com/questions/53062328/problem-with-reselect-when-adding-new-item-to-a-large-array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant