Bug 207377 - IndexedDB: index cursor iteration is slow when there are a lot of index records from different object stores
Summary: IndexedDB: index cursor iteration is slow when there are a lot of index recor...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: Safari Technology Preview
Hardware: All All
: P2 Major
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-07 01:51 PST by Carlos
Modified: 2020-02-17 09:45 PST (History)
8 users (show)

See Also:


Attachments
Bug Reproducer (3.30 KB, text/html)
2020-02-07 01:51 PST, Carlos
no flags Details
Patch (4.40 KB, patch)
2020-02-14 14:20 PST, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos 2020-02-07 01:51:22 PST
Created attachment 390067 [details]
Bug Reproducer

The fact of having an object store with a lot of data is impacting in the performance of the rest of object stores, making the openCursor operation much slower when using an index (even if the object store that we want to read is almost empty).

Note that when not using an index (IDBIndex), the performance seems to be not affected.

Tested with Safari Technology preview release 100 (Safari 13.2, WebKit 15610.1.2.1) on Mac, and with Safari 13 on iOS.

Steps to reproduce: 

1- Open the attached reproducer, performance.html. An IndexedDB database with two objectStores (testStore and testStore2) is created.
2- Click in “Read data (object store)”, it reads the contents of the object store “testStore2” using the openCursor operation directly with the objectStore. The testStore2 is empty and the read finishes in a few milliseconds.
3- Click in “Read data (index)”, it reads the contents of the object store “testStore2” using the openCursor operation by an index of testStore2. The testStore2 is empty and the read finishes in a few milliseconds.
4- Click in “Populate database” and wait until it finishes. It will populate “testStore” with 250000 records and testStore2 with 10 records.
5- Click in “Read data (object store)”. Reading again testStore2 (which is almost empty, 10 records). It finishes in a few milliseconds.
6- Click in “Read data (index)”. Reading again objectStestStore2tore2 (which is almost empty, 10 records). It takes at least 200 ms
Comment 1 Radar WebKit Bug Importer 2020-02-08 13:28:12 PST
<rdar://problem/59288679>
Comment 2 Sihui Liu 2020-02-14 14:20:52 PST
Created attachment 390818 [details]
Patch
Comment 3 Sihui Liu 2020-02-14 16:21:13 PST
The layout test failure is not caused by the patch.
Comment 4 WebKit Commit Bot 2020-02-17 09:44:59 PST
Comment on attachment 390818 [details]
Patch

Clearing flags on attachment: 390818

Committed r256738: <https://trac.webkit.org/changeset/256738>
Comment 5 WebKit Commit Bot 2020-02-17 09:45:00 PST
All reviewed patches have been landed.  Closing bug.