themoeway / yomitan

Japanese pop-up dictionary browser extension. Successor to Yomichan.
https://chromewebstore.google.com/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn
GNU General Public License v3.0
944 stars 72 forks source link

Import Dictionary Collection leads to startup and lookup lag compared to individual imports #329

Open Mansive opened 7 months ago

Mansive commented 7 months ago

Description When using the "Import Dictionary Collection" feature, Yomitan takes longer to startup and lookup speed slower than if the same dictionaries were imported individually. The lag is more prominent on Kiwi Browser than desktop browsers. For example, when opening up Kiwi Browser on a Poke 3 eReader, Yomitan may take 30 seconds to 3 minutes to fully load, or 15 seconds on a modern Android device. Notably, ttu reader is prevented from loading in any books until Yomitan finishes loading. The issues are imperceptible or not as apparent when the dictionaries are imported individually.

Browser version Kiwi Browser 6975122457, 8109440386

Yomitan version 23.11.23.0, 24.01.14.0

djahandarie commented 7 months ago

Maybe the first debugging step here would be to compare the state of IndexedDB after an import of a single dictionary vs an import of a dictionary collection (containing just that one DB). It's possible there is some bug in how we are using dexie-export-import that is causing extra records to be generated. That would hopefully be not too hard to fix.

However, if the state ends up being the exact same, then we might be dealing with a harder-to-fix bug that has to do with insert order and fragmentation or something like that in IndexedDB. Let's hope it's not that though.