summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2012-11-14 13:16:29 (EST)
committerIan Bull2012-11-14 13:18:18 (EST)
commitd709ac369fb457887ecb709a3680da983bb9d9cc (patch)
treef9778191c470a409682fd10ac76276e5b9c2c218
parentc047b832c621a1a35781a1e2ffb9ec0abfce590c (diff)
downloadrt.equinox.p2-d709ac369fb457887ecb709a3680da983bb9d9cc.zip
rt.equinox.p2-d709ac369fb457887ecb709a3680da983bb9d9cc.tar.gz
rt.equinox.p2-d709ac369fb457887ecb709a3680da983bb9d9cc.tar.bz2
Bug 384646: Improves the performance of the install software filter
This changeset includes two approaches to fix the performance problems in the p2 Install Software Dialog: 1. The children of a category are now cached. This ensures that the tree is only built once. 2. When computing the members of a category, we now do a 'piped query'. Instead of searching all IUs in a repo to see if they are in a category, we limit ourselves to only IUs which should be shown. This was available from the policy as a "top level query".
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java7
2 files changed, 12 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
index 3bee4d9..884448c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
@@ -141,7 +141,11 @@ public class QueryProvider {
// We need an expression that uses the requirements of the element's requirements, which could be merged
// from multiple category IUs shown as one in the UI.
IExpression matchesRequirementsExpression = ExpressionUtil.parse("$0.exists(r | this ~= r)"); //$NON-NLS-1$
- memberOfCategoryQuery = QueryUtil.createMatchQuery(matchesRequirementsExpression, ((CategoryElement) element).getRequirements());
+ // First perform the "top level" query to limit the amount of
+ // data we need to match in our category query.
+ IQuery<IInstallableUnit> iuGroupQuery = topLevelQuery;
+ IQuery<IInstallableUnit> memberQuery = QueryUtil.createMatchQuery(matchesRequirementsExpression, ((CategoryElement) element).getRequirements());
+ memberOfCategoryQuery = QueryUtil.createPipeQuery(iuGroupQuery, memberQuery);
} else {
memberOfCategoryQuery = QueryUtil.createIUCategoryMemberQuery(((IIUElement) element).getIU());
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
index a478e68..451cfc7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
@@ -66,6 +66,10 @@ public abstract class QueriedElement extends ProvElement {
}
public Object[] getChildren(Object o) {
+ Object[] cache = getCachedChildren();
+ if (cache.length > 0) {
+ return getCachedChildren();
+ }
return fetchChildren(o, new NullProgressMonitor());
}
@@ -159,6 +163,9 @@ public abstract class QueriedElement extends ProvElement {
}
public Object[] getCachedChildren() {
+ if (cachedChildren == null) {
+ return new Object[0];
+ }
return cachedChildren.toArray();
}