Skip to content
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

indexdb is slow #118

Closed
neofuture opened this issue Jan 30, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@neofuture
Copy link

commented Jan 30, 2019

Describe the bug
When using indexdb on a record set of 40k records, a query is taking 20 second to return when websql is around 1/2 second

Expected behavior
Query to be quick as web sql, tested in safari.

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Jan 31, 2019

Could you provide an example of your code? The WebSQL code and IndexedDB code, that way I can figure out what's going on.

@neofuture

This comment has been minimized.

Copy link
Author

commented Jan 31, 2019

that's tricky because im sourcing the data real time from an internal xhr request, ill try and bundle it up with a Json tomorrow

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Jan 31, 2019

Think I have it taken care of. Put together a simple read test, inserts 5k records and does a full table scan. Tested all 3 browser adapters:

TEMP: 10.44189453125ms
WSQL: 44.31689453125ms
IDB: 213.552978515625ms

So yeah, IndexedDB is taking way longer than the other two.

I did some digging and IndexedDB 2 has a new api, getAll. It's way faster at pulling groups of rows out of IndexedDB. With the new API we get much better performance, now comparable with the other adapters:

TEMP: 10.4228515625ms
WSQL: 34.050048828125ms
IDB: 37.599853515625ms

IndexedDB 2 isn't supported by Edge but according to caniuse.com there's 80% user coverage for this feature. So we'll use the new API if it's there and fallback to the old one otherwise.

You'll see the improvement in 2.1.3 release coming out later today.

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Jan 31, 2019

2.1.3 is live, let me know if it fixes this for you.

@neofuture

This comment has been minimized.

Copy link
Author

commented Jan 31, 2019

Will do, do you have any time line on the Cordova implementation, this was the reason i was using 1.8.* due to safari removing web sql

@neofuture

This comment has been minimized.

Copy link
Author

commented Jan 31, 2019

That seems to have sorted it, queries are much faster now on IDB

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Jan 31, 2019

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.