If we're still waiting for a subscription and execute useFind(() => Docs.find()), then the cursor starts empty. Now when the server sends a blob of documents, we'll append them to the array one-by-one. This is slow in the current implementation (and react-meteor-data) because we make a new array each time, resulting in quadratic running time and a lot of heap thrashing. It would be better to duplicate the array, modify the array in-place, and then schedule an update to the Solid signal after all changes have happened (after tick).
Oh, actually, a much simpler solution would be to modify the array in-place, and change the signal to equals: false mode. This will not batch the changes. So still need to call set after a tick via setTimeout.
If we're still waiting for a subscription and execute
useFind(() => Docs.find())
, then the cursor starts empty. Now when the server sends a blob of documents, we'll append them to the array one-by-one. This is slow in the current implementation (and react-meteor-data) because we make a new array each time, resulting in quadratic running time and a lot of heap thrashing. It would be better to duplicate the array, modify the array in-place, and then schedule an update to the Solid signal after all changes have happened (after tick).Oh, actually, a much simpler solution would be to modify the array in-place, and change the signal to
equals: false
mode. This will not batch the changes. So still need to callset
after a tick viasetTimeout
.