Skip to content

Fix bulkSet#56

Open
quolpr wants to merge 2 commits intojlongster:masterfrom
quolpr:fix-bulk-set
Open

Fix bulkSet#56
quolpr wants to merge 2 commits intojlongster:masterfrom
quolpr:fix-bulk-set

Conversation

@quolpr
Copy link
Contributor

@quolpr quolpr commented Jul 11, 2022

I think it may potentially fix #30

After that fix, the writing performance become slower. But we should await before all the writes finish to finish the transaction. Otherwise, the next read IDB (when you want to execute SELECT for example) will need to await when previous INSERT will finish, which is not fair for the SELECT query. And, it seems the benchmarks are wrong at the article (but not so much! The write performance is still amazing).

Also, I don't see any performance penalty of Promise.all usage — the new IDB transactions are not spawning, the overall performance at the first glance is the same.

@quolpr
Copy link
Contributor Author

quolpr commented Jul 12, 2022

Here is the example, without await and with. You can notice that without await the next select query slow down a lot (cause IDB wait write transaction to finish). And with await, the next select query is fast. And in sum, the run time for both cases is 2 secs.

example4.mp4

@quolpr
Copy link
Contributor Author

quolpr commented Jul 13, 2022

Update: this PR actually doesn't fix #30 😢 But still without awaiting the next query will be much slower, cause internally IDB don't finish writing and next read will await those writings to finish

@hoangqwe159
Copy link

@quolpr did you try with https://www.npmjs.com/package/idb?

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.

Database disk image is malformed error sometimes

2 participants