-
Notifications
You must be signed in to change notification settings - Fork 1.5k
(#6059) - use batch cursor in allDocs() #6060
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
Conversation
618849d to
bd279aa
Compare
|
Interestingly this is a perf boost relative to master in Firefox, but a regression in Chrome (chrome 119ms -> 868ms, firefox 496ms -> 157ms for an edit: it's a perf boost in Chrome as well if you consider the cost of the |
|
Hm, based on these recent results I'm starting to suspect that I am still happy with this PR but I'm sad that the docCount optimization helped so much in Chrome. |
|
OK, in order to compare apples to apples, I compared using the new
So oddly it is a perf regression in Chrome. Apparently it's faster to fetch 10 documents using a cursor than to fetch them all at once using a single This is a weird result, but I still think this is a good PR. We can improve Chrome perf by doing #6068. Also even if it's a bit slower, I can see from Dev Tools timelines that it spends less time on the UI thread because it has fewer callbacks. And a different benchmark may give a different result, e.g. a batch size of 50 instead of 10. |
|
Small bug in |
|
Collapsed commits so it's easier to read. |
daleharvey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a rebase but looks great, thanks
|
Rebased, will wait for a green before merging. |
|
Green! |
I rebased this on #6056 to avoid bitrotting myself.
This extends our use of
getAll()/getAllKeys()toallDocs(), in addition to the work already done to use it inchanges().This was a bit trickier because the two have slightly different use cases, but this is documented in the code comments forrunBatchedCursor.js.There is an additional optimization we can do here where we avoidgetAllKeys()entirely forallDocs()(it's not necessary, since unlike theby-seq-storefor thedoc-storewe can derive the key from the value; it's not an autoincrementing key). However I'll save that for a future PR.edit: I have a new implementation using batched cursors or a regular
getAlldepending on the scenario.Benchmarks are TBD but in principle this is faster with no increased memory costs since we're still keeping the batch size limited based on
limit.