You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2011/05/13 15:36:43 UTC

svn commit: r1102723 - in /myfaces/core/trunk: api/src/main/java/javax/faces/component/ api/src/main/java/javax/faces/component/behavior/ impl/src/main/java/org/apache/myfaces/application/ impl/src/main/java/org/apache/myfaces/view/facelets/

Author: martinkoci
Date: Fri May 13 13:36:42 2011
New Revision: 1102723

URL: http://svn.apache.org/viewvc?rev=1102723&view=rev
Log:
MYFACES-3130 [PERF] Avoid unnecessary AbstractList$Itr instances

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/_DeltaList.java
    myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_DeltaList.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java Fri May 13 13:36:42 2011
@@ -656,8 +656,10 @@ public abstract class UIComponent implem
                 this.encodeChildren(context);
             } // let children render itself
             else {
-                if (this.getChildCount() > 0) {
-                    for (UIComponent comp : this.getChildren()) {
+                int childCount = this.getChildCount();
+                if (childCount > 0) {
+                    for (int i =0; i < childCount; i++) {
+                        UIComponent comp = this.getChildren().get(i);
                         comp.encodeAll(context);
                     }
                 }
@@ -827,8 +829,10 @@ public abstract class UIComponent implem
                         }
                     }
                 }
-                if (getChildCount() > 0) {
-                    for (UIComponent child : getChildren()) {
+                int childCount = getChildCount();
+                if (childCount > 0) {
+                    for (int i =0; i < childCount; i++) {
+                        UIComponent child = getChildren().get(i);
                         if (child.visitTree(context, callback)) {
                             return true;
                         }

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java Fri May 13 13:36:42 2011
@@ -1587,19 +1587,29 @@ public class UIData extends UIComponentB
             {
                 break;
             }
-
-            for (UIComponent child : getChildren())
+            
+            int childCount = getChildCount();
+            if (childCount > 0)
             {
-                if (child instanceof UIColumn)
+                for (int i = 0; i < childCount; i++)
                 {
-                    if (!child.isRendered())
-                    {
-                        // Column is not visible
-                        continue;
-                    }
-                    for (UIComponent columnChild : child.getChildren())
+                    UIComponent child = getChildren().get(i);
+                    if (child instanceof UIColumn)
                     {
-                        process(context, columnChild, processAction);
+                        if (!child.isRendered())
+                        {
+                            // Column is not visible
+                            continue;
+                        }
+                        int columnChildCount = child.getChildCount();
+                        if (columnChildCount > 0)
+                        {
+                            for (int j = 0; j < columnChildCount; j++)
+                            {
+                                UIComponent columnChild = child.getChildren().get(j);
+                                process(context, columnChild, processAction);
+                            }
+                        }
                     }
                 }
             }

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/_DeltaList.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_DeltaList.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/_DeltaList.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/_DeltaList.java Fri May 13 13:36:42 2011
@@ -337,8 +337,10 @@ class _DeltaList<T> implements List<T>, 
         _initialStateMarked = true;
         if (_delegate != null)
         {
-            for (T value : _delegate)
+            int size = _delegate.size();
+            for (int i = 0; i < size; i++)
             {
+                T value = _delegate.get(i);
                 if (value instanceof PartialStateHolder)
                 {
                     ((PartialStateHolder)value).markInitialState();

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_DeltaList.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_DeltaList.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_DeltaList.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_DeltaList.java Fri May 13 13:36:42 2011
@@ -340,8 +340,10 @@ class _DeltaList<T> implements List<T>, 
         _initialStateMarked = true;
         if (_delegate != null)
         {
-            for (T value : _delegate)
+            int size = _delegate.size();
+            for (int i = 0; i < size; i++)
             {
+                T value = _delegate.get(i);
                 if (value instanceof PartialStateHolder)
                 {
                     ((PartialStateHolder)value).markInitialState();

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java Fri May 13 13:36:42 2011
@@ -1515,7 +1515,7 @@ public class ApplicationImpl extends App
             }
         }
 
-        if (converterConfig != null)
+        if (converterConfig != null && converterConfig.getProperties().size() > 0)
         {
             for (Property property : converterConfig.getProperties())
             {

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=1102723&r1=1102722&r2=1102723&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Fri May 13 13:36:42 2011
@@ -470,10 +470,12 @@ public class FaceletViewDeclarationLangu
             }
         }
         
-        if (view.getChildCount() > 0)
+        int childCount = view.getChildCount();
+        if (childCount > 0)
         {
-            for (UIComponent child : view.getChildren())
-            {
+            for (int i = 0; i < childCount; i++)
+            {
+                UIComponent child = view.getChildren().get(i);
                 if (!child.isTransient())
                 {
                     _markInitialState(child);
@@ -501,10 +503,12 @@ public class FaceletViewDeclarationLangu
     {
         component.markInitialState();
         
-        if (component.getChildCount() > 0)
+        final int childCount = component.getChildCount();
+        if (childCount > 0)
         {
-            for (UIComponent child : component.getChildren())
-            {
+            for (int i = 0; i < childCount; i++)
+            {
+                UIComponent child = component.getChildren().get(i);
                 if (!child.isTransient())
                 {
                     _markInitialState(child);