Skip to content

Conversation

@nolanlawson
Copy link
Member

@nolanlawson nolanlawson commented Dec 24, 2016

This re-implements the docCount optimization for IDB, but this time doing it in-database rather than in-memory, so it actually works across tabs/workers.

I rebased this on #6060 (which itself was rebased on #6056) because I really wanted to avoid bitrot. Sorry for the confusion.

The implementation is essentially do the same thing we were doing before, but instead of caching the docCount in-memory, we cache it in the META_STORE. It's always re-calculated when the database is initialized, and then after that the cached value is used during allDocs(), and updated based on a delta calculation system in bulkDocs().

I measured the perf gain using FF50, Chrome 55, and Edge 14 (2013 MBA, Edge running in Parallels). The test was all-docs-startkey-endkey from #6067, bumped up to 50 iterations for better accuracy. I measured only the difference between #6060 and this PR:

Before After Improvement
Firefox 982ms 1045ms -6.44%
Chrome 6132ms 2795ms +55.4%
Edge 9486ms 5353ms +43.5%

So it's a mild perf regression for Firefox, but a huge win for Chrome and Edge. And given that Firefox is already faster than Chrome, I think this is a huge improvement.

@nolanlawson
Copy link
Member Author

Legit failure in Android 5, Chromium 37. I will investigate

@nolanlawson nolanlawson force-pushed the 6068 branch 2 times, most recently from f412ecd to 349f7d2 Compare December 27, 2016 04:32
@nolanlawson
Copy link
Member Author

Failures are still genuine in Android. This needs work.

@nolanlawson
Copy link
Member Author

Green!

Copy link
Contributor

@daleharvey daleharvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me, thanks

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

Successfully merging this pull request may close these issues.

2 participants