Intent to Ship: Indexed DB "getAll()" and some other V2 APIs

44 views
Skip to first unread message

Joshua Bell

unread,
Oct 5, 2015, 7:07:23 PM10/5/15
to blink-dev

Contact emails

jsb...@google.com, cmum...@google.com


Spec

Editor's Draft: https://w3c.github.io/IndexedDB/ - note that we are NOT proposing shipping all of the "new in this version" features, just the subset listed below.


Summary

This adds the following methods to existing Indexed DB interfaces:
  • IDBObjectStore.getAll()
  • IDBObjectStore.getAllKeys()
  • IDBIndex.getAll()
  • IDBIndex.getAllKeys()
These take a query (null or key or key range) and yield a JS Array with all matching results. Since IDB results are delivered as events, this dramatically reduces the overhead when delivering thousands of results. The team working on Lovefield (a high performance query engine on top of IDB) reported[1] a significant speed-up using these methods - and in our own testing we see an up-to 5x read speedup compared to issuing multiple parallel get() requests (best possible today, if keys are known ahead of time), and far higher than iterating a cursor (if keys are not known). Since event delivery also takes place on the main thread, this also reduces jank when loading data. These methods have shipped experimentally in FF for many versions as well.


  • IDBObjectStore.openKeyCursor()
IDBIndex has openCursor() and openKeyCursor() - the latter does not retrieve values which avoids value transport/deserialization overhead when not needed (e.g. membership testing, joins, etc). IDBObjectStore only had openCursor(); adding this method allows a slight performance boost for stores as well. This method has shipped experimentally in FF for many versions.
  • IDBTransaction.objectStoreNames
This is a convenience attribute that yields the stores in the scope of the transaction, as specified when starting the transaction. For upgrade transactions it yields the same thing as db.objectStoreNames. This attribute has shipped (unprefixed, not behind a flag) in FF for many versions.


Link to “Intent to Implement” blink-dev discussion

https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/LNvvdSbgAqw/9AN1w9scALoJ


Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Demo link

http://inexorabletash.github.io/getalldemo - basic comparison of speed & jank benefits of getAll vs. parallel gets.


Compatibility Risk

FF has implemented all of these behind a flag. Tracking bug to ship: https://bugzilla.mozilla.org/show_bug.cgi?id=1196841 - we've imported Moz's tests for these into Blink, which we pass.


OWP launch tracking bug

https://code.google.com/p/chromium/issues/detail?id=525742


Entry on the feature dashboard

https://www.chromestatus.com/features/6537756637396992



TAMURA, Kent

unread,
Oct 6, 2015, 6:28:45 PM10/6/15
to Joshua Bell, blink-dev
LGTM1.

--
TAMURA Kent
Software Engineer, Google


Chris Harrelson

unread,
Oct 6, 2015, 7:05:47 PM10/6/15
to TAMURA, Kent, Joshua Bell, blink-dev
LGTM2
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Dimitri Glazkov

unread,
Oct 13, 2015, 10:48:34 AM10/13/15
to Chris Harrelson, TAMURA, Kent, Joshua Bell, blink-dev
LGTM3.

:DG<
Reply all
Reply to author
Forward
0 new messages