myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martink...@apache.org
Subject svn commit: r1133517 - in /myfaces/core/trunk: api/src/main/java/javax/faces/component/ api/src/main/java/javax/faces/render/ impl/src/main/java/org/apache/myfaces/application/ impl/src/main/java/org/apache/myfaces/context/servlet/ impl/src/main/java/o...
Date Wed, 08 Jun 2011 19:19:52 GMT
Author: martinkoci
Date: Wed Jun  8 19:19:52 2011
New Revision: 1133517

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

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
    myfaces/core/trunk/api/src/main/java/javax/faces/render/Renderer.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java Wed Jun
 8 19:19:52 2011
@@ -248,8 +248,9 @@ public abstract class UIComponentBase ex
         
         if (component.getChildCount() > 0)
         {
-            for (UIComponent child : component.getChildren())
+            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = component.getChildren().get(i);
                 _publishPreRemoveFromViewEvent(context, child);
             }
         }
@@ -475,8 +476,9 @@ public abstract class UIComponentBase ex
                     // component and call UIComponent.encodeAll(javax.faces.context.FacesContext).
                     if (getChildCount() > 0)
                     {
-                        for (UIComponent child : getChildren())
+                        for (int i = 0, childCount = getChildCount(); i < childCount;
i++)
                         {
+                            UIComponent child = getChildren().get(i);
                             child.encodeAll(context);
                         }
                     }
@@ -1362,8 +1364,9 @@ public abstract class UIComponentBase ex
 
                 // To improve speed and robustness, the facets and children processing is
splited to maintain the
                 // facet --> state coherence based on the facet's name
-                for (UIComponent child : getChildren())
+                for (int i = 0; i < childCount; i++)
                 {
+                    UIComponent child = getChildren().get(i);
                     if (!child.isTransient())
                     {
                         if (childrenList == null)
@@ -1448,8 +1451,9 @@ public abstract class UIComponentBase ex
                 // To improve speed and robustness, the facets and children processing is
splited to maintain the
                 // facet --> state coherence based on the facet's name
                 int idx = 0;
-                for (UIComponent child : getChildren())
+                for (int i = 0, childCount = getChildCount(); i < childCount; i++)
                 {
+                    UIComponent child = getChildren().get(i);
                     if (!child.isTransient())
                     {
                         Object childState = childrenList.get(idx++);

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/render/Renderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/render/Renderer.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/render/Renderer.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/render/Renderer.java Wed Jun  8 19:19:52
2011
@@ -70,8 +70,9 @@ public abstract class Renderer
 
         if (component.getChildCount() > 0)
         {
-            for (UIComponent child : component.getChildren())
+            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = component.getChildren().get(i);
                 if (!child.isRendered())
                 {
                     continue;

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
Wed Jun  8 19:19:52 2011
@@ -56,8 +56,9 @@ public class TreeStructureManager
         if (component.getChildCount() > 0)
         {
             List<TreeStructComponent> structChildList = new ArrayList<TreeStructComponent>();
-            for (UIComponent child : component.getChildren())
+            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = component.getChildren().get(i);
                 if (!child.isTransient())
                 {
                     TreeStructComponent structChild = internalBuildTreeStructureToSave(child);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
Wed Jun  8 19:19:52 2011
@@ -486,8 +486,9 @@ public class PartialViewContextImpl exte
                 //comp.encodeAll (_facesContext);
             //}
         //}
-        for (UIComponent comp : viewRoot.getChildren())
+        for (int i = 0, childCount = viewRoot.getChildCount(); i < childCount; i++)
         {
+            UIComponent comp = viewRoot.getChildren().get(i);
             comp.encodeAll (_facesContext);
         }
         writer.endUpdate();

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
Wed Jun  8 19:19:52 2011
@@ -678,8 +678,9 @@ public final class ErrorPageWriter
             }
             if (c.getChildCount() > 0)
             {
-                for (UIComponent child : c.getChildren())
+                for (int i = 0, childCount = c.getChildCount(); i < childCount; i++)
                 {
+                    UIComponent child = c.getChildren().get(i);
                     writer.write("<dd>");
                     _writeComponent(faces, writer, child, highlightId);
                     writer.write("</dd>");
@@ -974,8 +975,9 @@ public final class ErrorPageWriter
     
     private static boolean _isFirstUIColumn(UIComponent uidata, UIColumn uicolumn)
     {
-        for (UIComponent child : uidata.getChildren())
+        for (int i = 0, childCount = uidata.getChildCount(); i < childCount; i++)
         {
+            UIComponent child = uidata.getChildren().get(i);
             if (child instanceof UIColumn)
             {
                 return (child == uicolumn);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java Wed Jun
 8 19:19:52 2011
@@ -310,8 +310,9 @@ public class DebugUtils
 
                 if (childCount > 0)
                 {
-                    for (UIComponent child : comp.getChildren())
+                    for (int i = 0; i < childCount; i++)
                     {
+                        UIComponent child = comp.getChildren().get(i);
                         printComponent(child, stream, indent + 1, true, null);
                     }
                 }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
Wed Jun  8 19:19:52 2011
@@ -746,8 +746,9 @@ public class DefaultFaceletsStateManagem
         c.clearInitialState();
         if (c.getChildCount() > 0)
         {
-            for (UIComponent child : c.getChildren())
+            for (int i = 0, childCount = c.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = c.getChildren().get(i);
                 ensureClearInitialState(child);
             }
         }
@@ -947,8 +948,9 @@ public class DefaultFaceletsStateManagem
         if (component.getChildCount() > 0)
         {
             List<TreeStructComponent> structChildList = new ArrayList<TreeStructComponent>();
-            for (UIComponent child : component.getChildren())
+            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = component.getChildren().get(i);     
                 if (!child.isTransient())
                 {
                     TreeStructComponent structChild = internalBuildTreeStructureToSave(child);

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=1133517&r1=1133516&r2=1133517&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
Wed Jun  8 19:19:52 2011
@@ -538,8 +538,9 @@ public class FaceletViewDeclarationLangu
         
         if (component.getChildCount() > 0)
         {
-            for (UIComponent child : component.getChildren())
+            for (int j = 0, childCount = component.getChildCount(); j < childCount; j++)
             {
+                UIComponent child = component.getChildren().get(j);
                 _publishPreRemoveFromViewEvent(context, child);
             }
         }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/RepeatRenderer.java
Wed Jun  8 19:19:52 2011
@@ -72,8 +72,9 @@ public class RepeatRenderer extends Rend
                 }
             }
             
-            for (UIComponent child : component.getChildren())
+            for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
             {
+                UIComponent child = component.getChildren().get(i);
                 child.encodeAll(context);
             }
 

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/UIRepeat.java
Wed Jun  8 19:19:52 2011
@@ -399,8 +399,9 @@ public class UIRepeat extends UIComponen
         if (getChildCount() > 0)
         {
             FacesContext context = getFacesContext();
-            for (UIComponent child : getChildren())
+            for (int i = 0, childCount = getChildCount(); i < childCount; i++)
             {
+                UIComponent child = getChildren().get(i);
                 _restoreChildState(context, child);
             }
         }
@@ -441,8 +442,9 @@ public class UIRepeat extends UIComponen
         if (getChildCount() > 0)
         {
             FacesContext context = getFacesContext();
-            for (UIComponent child : getChildren())
+            for (int i = 0, childCount = getChildCount(); i < childCount; i++)
             {
+                UIComponent child = getChildren().get(i);
                 _saveChildState(context, child);
             }
         }
@@ -617,8 +619,9 @@ public class UIRepeat extends UIComponen
                     }
                     else
                     {
-                        for (UIComponent child : getChildren())
+                        for (int j = 0, childCount = getChildCount(); j < childCount;
j++)
                         {
+                            UIComponent child = getChildren().get(j);
                             if (PhaseId.APPLY_REQUEST_VALUES.equals(phase))
                             {
                                 child.processDecodes(faces);
@@ -819,8 +822,9 @@ public class UIRepeat extends UIComponen
                         _setIndex(i);
                         while (i <= end && _isIndexAvailable())
                         {
-                            for (UIComponent child : getChildren()) 
+                            for (int j = 0, childCount = getChildCount(); j < childCount;
j++)
                             {
+                                UIComponent child = getChildren().get(j);
                                 if (child.visitTree(context, callback)) 
                                 {
                                     return true;

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
Wed Jun  8 19:19:52 2011
@@ -109,10 +109,12 @@ public final class ComponentSupport
      */
     public static UIComponent findChild(UIComponent parent, String id)
     {
-        if (parent.getChildCount() > 0)
+        int childCount = parent.getChildCount();
+        if (childCount > 0)
         {
-            for (UIComponent child : parent.getChildren())
+            for (int i = 0; i < childCount; i++)
             {
+                UIComponent child = parent.getChildren().get(i);
                 if (id.equals(child.getId()))
                 {
                     return child;
@@ -286,8 +288,9 @@ public final class ComponentSupport
             }
             else if (toRender.getChildCount() > 0)
             {
-                for (UIComponent child : toRender.getChildren())
+                for (int i = 0, childCount = toRender.getChildCount(); i < childCount;
i++)
                 {
+                    UIComponent child = toRender.getChildren().get(i);
                     encodeRecursive(context, child);
                 }
             }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java?rev=1133517&r1=1133516&r2=1133517&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java
Wed Jun  8 19:19:52 2011
@@ -229,8 +229,9 @@ public class DebugPhaseListener implemen
             // check if there are already debugInfos from UIInput
             List<Object[]> fieldDebugInfos = getFieldDebugInfos(field, clientId);
             boolean found = false;
-            for (Object[] debugInfo : fieldDebugInfos)
+            for (int i = 0, size = fieldDebugInfos.size(); i < size; i++)
             {
+                Object[] debugInfo = fieldDebugInfos.get(i);
                 if (debugInfo[0].equals(_currentPhase))
                 {
                     found = true;



Mime
View raw message