yomidevs / yomitan

Pop-up dictionary browser extension. Successor to Yomichan.
https://yomitan.wiki
GNU General Public License v3.0
1.31k stars 103 forks source link

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

Open Mansive opened 1 year ago

Mansive commented 1 year 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 1 year 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.

Mansive commented 3 months ago

Still occurring on Kiwi Browser as of Yomitan version 24.7.31.0. Perhaps because of differences in dictionaries imported or Yomitan versions, the extension now takes over 4 minutes to load instead of 3 minutes on my ereader.