aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2013-08-21 10:45:54 +0300
committerVaadin Code Review <review@vaadin.com>2013-08-21 07:48:47 +0000
commit047303662b348bf73a69b81532f9ac5f4f12cc71 (patch)
treebbfda6682197d8386bfd868981099e5c95764674 /client
parentf5b67af0a4070a5f2d334aa7efa6d899f4ff60ce (diff)
downloadvaadin-framework-047303662b348bf73a69b81532f9ac5f4f12cc71.tar.gz
vaadin-framework-047303662b348bf73a69b81532f9ac5f4f12cc71.zip
Add more detailed profiling for some client side hotspots (#12418)
Change-Id: I27178a553571a99725ac4a75cae88d55398604ad
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/LayoutManager.java14
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java15
-rw-r--r--client/src/com/vaadin/client/ui/panel/PanelConnector.java10
4 files changed, 44 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index 14b155c92f..1ced003146 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -322,17 +322,22 @@ public class LayoutManager {
Collection<ElementResizeListener> listeners = elementResizeListeners
.get(element);
if (listeners != null) {
+ Profiler.enter("Layout fire resize events - listeners not null");
+ Profiler.enter("ElementResizeListener.onElementResize copy list");
ElementResizeListener[] array = listeners
.toArray(new ElementResizeListener[listeners
.size()]);
+ Profiler.leave("ElementResizeListener.onElementResize copy list");
ElementResizeEvent event = new ElementResizeEvent(this,
element);
for (ElementResizeListener listener : array) {
try {
String key = null;
if (Profiler.isEnabled()) {
- key = "ElementReizeListener.onElementReize for "
+ Profiler.enter("ElementResizeListener.onElementResize construct profiler key");
+ key = "ElementResizeListener.onElementResize for "
+ Util.getSimpleName(listener);
+ Profiler.leave("ElementResizeListener.onElementResize construct profiler key");
Profiler.enter(key);
}
@@ -344,6 +349,7 @@ public class LayoutManager {
VConsole.error(e);
}
}
+ Profiler.leave("Layout fire resize events - listeners not null");
}
}
listenersToFire.clear();
@@ -716,13 +722,19 @@ public class LayoutManager {
private void onConnectorChange(ComponentConnector connector,
boolean widthChanged, boolean heightChanged) {
Profiler.enter("LayoutManager.onConnectorChange");
+ Profiler.enter("LayoutManager.onConnectorChange setNeedsOverflowFix");
setNeedsOverflowFix(connector);
+ Profiler.leave("LayoutManager.onConnectorChange setNeedsOverflowFix");
+ Profiler.enter("LayoutManager.onConnectorChange heightChanged");
if (heightChanged) {
currentDependencyTree.markHeightAsChanged(connector);
}
+ Profiler.leave("LayoutManager.onConnectorChange heightChanged");
+ Profiler.enter("LayoutManager.onConnectorChange widthChanged");
if (widthChanged) {
currentDependencyTree.markWidthAsChanged(connector);
}
+ Profiler.leave("LayoutManager.onConnectorChange widthChanged");
Profiler.leave("LayoutManager.onConnectorChange");
}
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index d384549ee3..6f98e29d03 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -150,17 +150,23 @@ public abstract class AbstractComponentConnector extends AbstractConnector
}
Profiler.leave("AbstractComponentConnector.onStateChanged update tab index");
+ Profiler.enter("AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()");
super.onStateChanged(stateChangeEvent);
+ Profiler.leave("AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()");
// Style names
+ Profiler.enter("AbstractComponentConnector.onStateChanged updateWidgetStyleNames");
updateWidgetStyleNames();
+ Profiler.leave("AbstractComponentConnector.onStateChanged updateWidgetStyleNames");
/*
* updateComponentSize need to be after caption update so caption can be
* taken into account
*/
+ Profiler.enter("AbstractComponentConnector.onStateChanged updateComponentSize");
updateComponentSize();
+ Profiler.leave("AbstractComponentConnector.onStateChanged updateComponentSize");
Profiler.enter("AbstractComponentContainer.onStateChanged check tooltip");
if (!tooltipListenersAttached && hasTooltip()) {
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index 2ce45623d0..e148742b0b 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -26,6 +26,7 @@ import com.vaadin.client.FastStringMap;
import com.vaadin.client.FastStringSet;
import com.vaadin.client.HasComponentsConnector;
import com.vaadin.client.JsArrayObject;
+import com.vaadin.client.Profiler;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.Util;
import com.vaadin.client.VConsole;
@@ -267,6 +268,7 @@ public class LayoutDependencyTree {
}
public void markSizeAsChanged() {
+ Profiler.enter("LayoutDependency.markSizeAsChanged phase 1");
// When the size has changed, all that use that size should be
// layouted
JsArrayString needsSizeForLayout = getNeedsSizeForLayout();
@@ -276,14 +278,20 @@ public class LayoutDependencyTree {
LayoutDependency layoutDependency = getDependency(connectorId,
direction);
if (layoutDependency.connector instanceof ManagedLayout) {
+ Profiler.enter("LayoutDependency.markSizeAsChanged setNeedsLayout");
layoutDependency.setNeedsLayout(true);
+ Profiler.leave("LayoutDependency.markSizeAsChanged setNeedsLayout");
} else {
+ Profiler.enter("LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure");
// Should simulate setNeedsLayout(true) + markAsLayouted ->
// propagate needs measure
layoutDependency.propagatePostLayoutMeasure();
+ Profiler.leave("LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure");
}
}
+ Profiler.leave("LayoutDependency.markSizeAsChanged phase 1");
+ Profiler.enter("LayoutDependency.markSizeAsChanged scrollbars");
// Should also go through the hierarchy to discover appeared or
// disappeared scrollbars
ComponentConnector scrollingBoundary = getScrollingBoundary(connector);
@@ -291,6 +299,7 @@ public class LayoutDependencyTree {
getDependency(scrollingBoundary.getConnectorId(),
getOppositeDirection()).setNeedsMeasure(true);
}
+ Profiler.leave("LayoutDependency.markSizeAsChanged scrollbars");
}
@@ -332,22 +341,28 @@ public class LayoutDependencyTree {
}
private void propagatePostLayoutMeasure() {
+ Profiler.enter("LayoutDependency.propagatePostLayoutMeasure getResizedByLayout");
JsArrayString resizedByLayout = getResizedByLayout();
+ Profiler.leave("LayoutDependency.propagatePostLayoutMeasure getResizedByLayout");
int length = resizedByLayout.length();
for (int i = 0; i < length; i++) {
+ Profiler.enter("LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure");
String resizedId = resizedByLayout.get(i);
LayoutDependency layoutDependency = getDependency(resizedId,
direction);
layoutDependency.setNeedsMeasure(true);
+ Profiler.leave("LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure");
}
// Special case for e.g. wrapping texts
+ Profiler.enter("LayoutDependency.propagatePostLayoutMeasure horizontal case");
if (direction == HORIZONTAL && !connector.isUndefinedWidth()
&& connector.isUndefinedHeight()) {
LayoutDependency dependency = getDependency(
connector.getConnectorId(), VERTICAL);
dependency.setNeedsMeasure(true);
}
+ Profiler.leave("LayoutDependency.propagatePostLayoutMeasure horizontal case");
}
@Override
diff --git a/client/src/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/com/vaadin/client/ui/panel/PanelConnector.java
index fe211901c9..4011f86c76 100644
--- a/client/src/com/vaadin/client/ui/panel/PanelConnector.java
+++ b/client/src/com/vaadin/client/ui/panel/PanelConnector.java
@@ -23,6 +23,7 @@ import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorHierarchyChangeEvent;
import com.vaadin.client.LayoutManager;
import com.vaadin.client.Paintable;
+import com.vaadin.client.Profiler;
import com.vaadin.client.UIDL;
import com.vaadin.client.ui.AbstractSingleComponentContainerConnector;
import com.vaadin.client.ui.ClickEventHandler;
@@ -194,22 +195,31 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector
VPanel panel = getWidget();
LayoutManager layoutManager = getLayoutManager();
+ Profiler.enter("PanelConnector.layout getHeights");
int top = layoutManager.getOuterHeight(panel.captionNode);
int bottom = layoutManager.getInnerHeight(panel.bottomDecoration);
+ Profiler.leave("PanelConnector.layout getHeights");
+ Profiler.enter("PanelConnector.layout modify style");
Style style = panel.getElement().getStyle();
panel.captionNode.getParentElement().getStyle()
.setMarginTop(-top, Unit.PX);
panel.bottomDecoration.getStyle().setMarginBottom(-bottom, Unit.PX);
style.setPaddingTop(top, Unit.PX);
style.setPaddingBottom(bottom, Unit.PX);
+ Profiler.leave("PanelConnector.layout modify style");
// Update scroll positions
+ Profiler.enter("PanelConnector.layout update scroll positions");
panel.contentNode.setScrollTop(panel.scrollTop);
panel.contentNode.setScrollLeft(panel.scrollLeft);
+ Profiler.leave("PanelConnector.layout update scroll positions");
+
// Read actual value back to ensure update logic is correct
+ Profiler.enter("PanelConnector.layout read scroll positions");
panel.scrollTop = panel.contentNode.getScrollTop();
panel.scrollLeft = panel.contentNode.getScrollLeft();
+ Profiler.leave("PanelConnector.layout read scroll positions");
}
@Override