migaku-official / Migaku-Dictionary-Addon

Migaku Dictionary allows users to lookup word definitions, export definitions to their cards in real-time, hear word audio and see word frequency, etc. If you have an issue please report it in the "Issues" tab. Reponses to issues can be slow on GitHub, for faster support consider joining our Discord server through our Patreon page.
GNU General Public License v3.0
64 stars 24 forks source link

Improve responsiveness of dictionary window #58

Open dmgerman opened 3 years ago

dmgerman commented 3 years ago

Type:

Environment:

I'm going to open a PR to resolve the issue:

Description:

I profiled the dictionary lookup using the hotkey. With the PRAGMA PR that I submitted are still two issues that add to the time it takes to show the result to the user:

  1. The window is created every time the window is show. This window can probably be created at startup, once only for the entire session, instead of each time the window is shown.

  2. looking up words twice. In the tests I ran, the same queries were issued twice. There is probably a way to reduce the number of queries, but this improvement is probably one order the magnitude less than the issue #1 above.