Bug 232186 - Expensive localized property retrieval
Summary: Expensive localized property retrieval
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2008-05-14 16:52 EDT by John Arthorne CLA
Modified: 2008-05-14 18:29 EDT (History)
2 users (show)

See Also:
john.arthorne: review? (pascal)


Attachments
Stack trace during property retrieval while filtering (7.04 KB, text/plain)
2008-05-14 17:05 EDT, John Arthorne CLA
no flags Details
Optimization (2.25 KB, patch)
2008-05-14 17:29 EDT, John Arthorne CLA
no flags Details | Diff
Patch with manifest changes (3.84 KB, patch)
2008-05-14 17:42 EDT, John Arthorne CLA
no flags Details | Diff
Patch v03 (6.24 KB, patch)
2008-05-14 18:25 EDT, John Arthorne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2008-05-14 16:52:58 EDT
Build: I20080513-2000

In the available software tab, each keystroke in the filter field brings a delay of several seconds. This is because the filter code is performing a query against the localized IU names. Retrieving the localized value for an IU property requires a query over all repositories in the system. Thus each repository is being queried once per IU per keystroke (a lot).
Comment 1 John Arthorne CLA 2008-05-14 17:05:09 EDT
Created attachment 100311 [details]
Stack trace during property retrieval while filtering
Comment 2 Pascal Rapicault CLA 2008-05-14 17:10:19 EDT
We are addressing the issue in several ways:
- cache the result of translated strings into the IU object.
- address bug 232173

If this was not enough we could also cache the result of the query looking for translation IUs.
Comment 3 John Arthorne CLA 2008-05-14 17:29:45 EDT
Created attachment 100313 [details]
Optimization

This quick and dirty optimization stores the localized value in the InstallableUnit object. This will be flushed from memory once the repository is no longer referenced, but gives a huge gain in performance while the dialog is open.
Comment 4 John Arthorne CLA 2008-05-14 17:32:13 EDT
Unfortunately this patch requires accessing non-API to store the value on the IU object. I think eventually we should provide a method IInstallableUnit.getLocalizedProperty that can push this kind of optimization further down.
Comment 5 Susan McCourt CLA 2008-05-14 17:35:49 EDT
After this is fixed we should check the auto-updates scenario.  That is one workflow I know of where we might launch a wizard (update wizard) without first loading repos.

Most UI that hits repos (expanding in the software list, viewing by category or name, filtering over all repos) happens in jobs with some kind of deferred UI update.  

But I just had a case where I went to click the "updates available" affordance and it seemed to lock up the UI for a long time.  This was probably the first time those IU's names were being accessed for the purpose of showing names in the update wizard.

If we determine that the problem is that repos that don't matter are being loaded, we should look at using QueryableMetadataRepositoryManager rather than the real metadata repository manager in IUPropertyUtils for the query.  I can help with that.  That queryable allows you to set repo flags.  Because I would have thought that any repo that mattered for updates was already loaded by the time the updates were found
Comment 6 John Arthorne CLA 2008-05-14 17:42:04 EDT
Created attachment 100316 [details]
Patch with manifest changes
Comment 7 John Arthorne CLA 2008-05-14 18:25:40 EDT
Created attachment 100324 [details]
Patch v03

We realized my previous fix would cause the localized properties to be stored in the profile registry, and possibly in the metadata repository if it was local. This new patch stores the localized properties in a separate map that is never persisted.
Comment 8 John Arthorne CLA 2008-05-14 18:29:16 EDT
Released (Pascal reviewed).