aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSnjezana Peco2012-12-21 14:25:08 (EST)
committerPaul Webster2012-12-21 14:25:08 (EST)
commit6f90c7b6b3ca496b29382c792c4192eb27b3d882 (patch)
tree0c91f2460c6b269bea2f8fccbdabe8a0e449d3d1
parent9df5050edd19d95015a4c8e427771126a2053b08 (diff)
downloadeclipse.platform.runtime-6f90c7b6b3ca496b29382c792c4192eb27b3d882.zip
eclipse.platform.runtime-6f90c7b6b3ca496b29382c792c4192eb27b3d882.tar.gz
eclipse.platform.runtime-6f90c7b6b3ca496b29382c792c4192eb27b3d882.tar.bz2
Bug 389251 - [Performance] Idle Eclipse constantly allocates hundreds ofv20121221-192508M20130104-1300M20130102-1200M20121226-1200
objects per second Don't allocate the ContextChangeEvent unless necessary.
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
index 767e77c..f64cc11 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
@@ -255,9 +255,10 @@ public class EclipseContext implements IEclipseContext {
* computations and listeners that depend on this name.
*/
public void invalidate(String name, int eventType, Object oldValue, Object newValue, Set<Scheduled> scheduled) {
- ContextChangeEvent event = new ContextChangeEvent(this, eventType, null, name, oldValue);
+ ContextChangeEvent event = null;
ValueComputation computation = localValueComputations.get(name);
if (computation != null) {
+ event = new ContextChangeEvent(this, eventType, null, name, oldValue);
if (computation.shouldRemove(event)) {
localValueComputations.remove(name);
weakListeners.remove(computation);
@@ -265,7 +266,10 @@ public class EclipseContext implements IEclipseContext {
computation.handleInvalid(event, scheduled);
}
Set<Computation> namedComputations = weakListeners.getListeners(name);
- if (namedComputations != null) {
+ if (namedComputations != null && namedComputations.size() > 0) {
+ if (event == null) {
+ event = new ContextChangeEvent(this, eventType, null, name, oldValue);
+ }
for (Computation listener : namedComputations) {
listener.handleInvalid(event, scheduled);
}