Bug 233523 - Optimize query for translation lookup
Summary: Optimize query for translation lookup
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC2   Edit
Assignee: Dave Stevenson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-22 14:29 EDT by John Arthorne CLA
Modified: 2008-05-22 23:02 EDT (History)
1 user (show)

See Also:
pascal: review+
john.arthorne: review+


Attachments
Cache localization fragments in a soft ref (5.41 KB, patch)
2008-05-22 14:55 EDT, Dave Stevenson CLA
no flags Details | Diff
Avoid gc when getting cached localization fragments from soft ref (5.44 KB, patch)
2008-05-22 16:06 EDT, Dave Stevenson CLA
dstevens: review?
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-22 14:29:43 EDT
Forked from bug 232413.

Currently each time a translated string is looked up, it requires a query across every available repository. We should be able to cache these queries to avoid querying the entire world on each string lookup. For example, we could remember the collection of IUs that contribute values for a given locale, so that when doing a lookup in that locale, we only query the subset of IUs relevant for that locale.
Comment 1 Dave Stevenson CLA 2008-05-22 14:55:23 EDT
Created attachment 101591 [details]
Cache localization fragments in a soft ref
Comment 2 Pascal Rapicault CLA 2008-05-22 15:29:33 EDT
Access to the value of the soft reference should cache the result to avoid a potential GC (line 164)

 if (collectorRef != null && collectorRef.get() != null)
    return (Collector) collectorRef.get();

 should become

 if (collectorRef != null) {
    Collector result = (Collector) collectorRef.get();
    if (result != null)
	return result;
 }
Comment 3 Dave Stevenson CLA 2008-05-22 16:06:25 EDT
Created attachment 101607 [details]
Avoid gc when getting cached localization fragments from soft ref

New caching patch with Pascal's suggestion to avoid gc when getting value from the soft reference.
Comment 4 Pascal Rapicault CLA 2008-05-22 16:09:44 EDT
+1
One other little improvement is to break out of the outer most loop in localeFragmentCollector query since we know for sure that the IU is good (line 183).
Comment 5 Pascal Rapicault CLA 2008-05-22 16:15:55 EDT
forget my latest comment.
Comment 6 John Arthorne CLA 2008-05-22 23:02:51 EDT
+1 for this patch, although unfortunately it doesn't seem to give me a big speedup. I think we have a bug in our update site caching. Whenever I test this, if I suspend I see feature jars being downloaded during update site generation, even though I am running with sites I have browsed many times in previous sessions.

Patch released.