You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/03/18 09:05:31 UTC

[2/2] git commit: Small perfomance improvement - Component#isAuto() walks the parents so it is more expensive than the other checks. Always check it last.

Small perfomance improvement - Component#isAuto() walks the parents so it is more expensive than the other checks.
Always check it last.

Pointed-by: Yourkit


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a5ed5f36
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a5ed5f36
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a5ed5f36

Branch: refs/heads/wicket-6.x
Commit: a5ed5f3672513c0b5ec6415bd8e05317da3c3012
Parents: de424fe
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Mar 18 10:03:45 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Mar 18 10:03:45 2014 +0200

----------------------------------------------------------------------
 wicket-core/src/main/java/org/apache/wicket/Component.java       | 2 +-
 wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a5ed5f36/wicket-core/src/main/java/org/apache/wicket/Component.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java
index 6e6c7da..8bfc9b4 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -3591,7 +3591,7 @@ public abstract class Component
 	protected void checkHierarchyChange(final Component component)
 	{
 		// Throw exception if modification is attempted during rendering
-		if (!component.isAuto() && getFlag(FLAG_RENDERING))
+		if (getFlag(FLAG_RENDERING) && !component.isAuto())
 		{
 			throw new WicketRuntimeException(
 				"Cannot modify component hierarchy after render phase has started (page version cant change then anymore)");

http://git-wip-us.apache.org/repos/asf/wicket/blob/a5ed5f36/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
index 85eb11c..8e61253 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -1605,7 +1605,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 				// We need to keep InlineEnclosures for Ajax request handling.
 				// TODO this is really ugly. Feature request for 1.5: change auto-component that
 				// they don't need to be removed anymore.
-				if (component.isAuto() && !(component instanceof InlineEnclosure))
+				if (!(component instanceof InlineEnclosure) && component.isAuto())
 				{
 					children_remove(i);
 				}