Closed jefffriesen closed 8 years ago
Just pushed version 2.1.6
which should address this issue. It might be the case that the call stack issue is disappeared but that the operation is slow, just let me know if that is the case.
Yep, that fixed it. Thank you. I'm curios how you knew that splatting the arrays was causing the problems.
As usual, stack overflow http://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why :)
Really interesting thread. Thanks for sharing. The call stack isn't being maxed out, but classifying and filtering are pretty slow (5-7 seconds to perform something). At this point I think this is probably on me to re-evaluate and optimize how I'm doing the classifying and filtering. Or break the data set up into smaller pieces.
thanks
Yes reactive sorting is pretty expensive on large collections, because there are many values and function calls to be tracked. After all the result of your sort depends on any value in the array that is used in the comparison function. (Not only the array can change, but also the values in the objects could influence the result of the sort and hence they need to be tracked). There are some optimizations that can be applied, but they are not generically applicable.
See also #166 which will improve the time needed to update a derived sorted array after an update a lot. The initial sort will remain expensive though
@mweststrate suggested I post this as a ticket after discussing the problem on Gitter. I also saw issue #236 but decided to not post it on there in case it's a different problem.
On Gitter, I mentioned maxing out the call stack on a filter. I realized it was also happening on a simpler function so I'll post that here.
Context: After importing lots of records, I'm assigning one or more classifications to that record based on a description field. So for 1000 records, I will have:
Everything works great when I load 1000 records. When I load 88,000 records I get the max call stack error.
Here is the relevant bits in the observable store:
Here is
updateClassifications()
. Apologize for all of the code , but I don't know how to cut this down and still make it functional.Here is the error:
and console.log of the keywords and records (records are the ones that I have 88,000+ rows):
Let me know if I can provide any more info. Thanks