hack-pad / go-indexeddb

An IndexedDB driver for Go code compiled to WebAssembly.
Apache License 2.0
28 stars 4 forks source link

IDBObjectStore.getAll() #4

Open oliverlj opened 2 years ago

oliverlj commented 2 years ago

It is possible to add method IDBObjectStore.getAll() which is faster than open a cursor ?

https://developer.mozilla.org/fr/docs/Web/API/IDBObjectStore/getAll

Thanks

JohnStarich commented 2 years ago

Hey @oliverlj, thanks for opening. I’m open to adding that method on the object store since it’s in the spec. If you’d like, you’re welcome to create a PR for it.

I don’t have much experience with the performance of getAll(), though I’d be surprised if the cursor were noticeably slower. Cursors are supposed to make large accesses a bit more efficient so that’s interesting. 🤔 Out of curiosity, do you have an article or something I could read up on?

oliverlj commented 2 years ago

I found the performance information in this article : https://rxdb.info/slow-indexeddb.html

yep, I can try to do a PR for this

JohnStarich commented 2 years ago

That's a great article, thank you for sharing. For whatever reason, this one didn't come up in my early research on this topic. Definitely bookmarking 🙂

Thanks for giving it a shot. I suspect we'll need to add 2 new methods to *baseObjectStore so it is picked up by both *Index and *ObjectStore. If modeling them after the key-only versions, then it might look like GetAll() and GetAllRange(*KeyRange, uint).

gedw99 commented 1 year ago

Hey @JohnStarich

April 2023: Since beginning of 2023, all modern browsers ship the File System Access API which allows to persistently store data in the browser with a way better performance. about 4x performance improvement compared to IndexedDB...

OPFS / File System https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API