demo · v133

Cursor vs getAllRecords — the 350ms Microsoft benchmark

Seed an IndexedDB store with N records, then read them back two ways: the classic openCursor() loop (one round-trip per record) and the new getAllRecords() (single round-trip). Reproduce the chromestatus 350ms speedup locally.

cursor (ms)
getAllRecords (ms)
speedup
records seeded
0

why the difference

Each step of an IndexedDB cursor is a separate task on the main thread. getAllRecords() collapses that to one call, returning an array of { primaryKey, key, value } records.

const records = await store.getAllRecords({
  query: IDBKeyRange.lowerBound(0),
  count: 10000,
  direction: "prev",
});

see also