Copy link to clipboard
Copied
The LrKeyword methods appear to be very slow, making them impractical for interactive plugins that manipulate all the keywords in a catalog. Has anyone else encountered this or have any suggestions?
The methods :getAttributes, :getChildren, :getName, :getParent, :getPhotos, and :getSynonyms each take about 15 msecs on a catalog with 16K photos and 588 keywords. To get the string names of all the keywords in the catalog takes about 17 seconds. This means a user would have to wait quite a while as the plugin fetches all the keywords. A workaround is for the plugin to cache the keywords and provide a "reload cache" button, but that's pretty klutzy.
While getting all the keywords in a catalog, the CPU utilization is low and there is little disk activity, suggesting a locking problem or that LR is accessing the database (the relevant parts being cached in memory).
One suggestion: provide a batch method for getting all the keyword information all at once.
Copy link to clipboard
Copied
Hi John, you are not alone with this issue. It is true - the keyword handling is terribly slow. For one of my plug-ins I have solved this problem in that way, that I build a custom table with all values I needed, e.g. {name as String, hierarchy (as string), value (as LrKeyword)} When the plug-in is started all keywords will be read into this table.
Ok, now it takes some seconds, but during the rest of the runtime it is much much faster to work on the table. I also experimented to store that custom table as part of the LrPrefs, but this happened in problems (when modifying the keywords outside of the plugin).
regards,
Lars
Copy link to clipboard
Copied
Well, at least your experience suggests I'm not doing something obviously wrong.
I've started storing the keyword list in the LrPrefs, re-getting them when the catalog changes and providing a "reload" button in the plugin dialog. That seems to work ok.