-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
IDBObjectStore.count
is O(n^2)
#94
Comments
Yeah that is excessively slow! Well, a lot of things in this library are not exactly optimized for speed, but if it's a small amount of code for a big speed up, then that should be done. Does #95 fix things for your use case? |
Wow, that was quick! Yes, that's much better, thank you! |
I saw the notification and was like "come on, no way it's that slow" so I had to investigate and... it was that slow lol Released in version 5.0.2 |
To pick up fix to dumbmatter/fakeIndexedDB#94
To pick up fix to dumbmatter/fakeIndexedDB#94
To pick up fix to dumbmatter/fakeIndexedDB#94
To pick up fix to dumbmatter/fakeIndexedDB#94
To pick up fix to dumbmatter/fakeIndexedDB#94
To pick up fix to dumbmatter/fakeIndexedDB#94
The implementation of
IDBObjectStore.count
uses a cursor internally, which would be fine, except that iterating a cursor isO(n)
in the number of entries in the store (FDBCursor.iterate
looks through all entries until it finds one whose position is greater than that of the cursor).The net result is that
IDBObjectStore.count
is extremely slow, to the extent that it's much faster to callIDBObjectStore.getAllKeys()
and count the results in the array... provided, of course, that it fits in memory.The text was updated successfully, but these errors were encountered: