ICEfaces
  1. ICEfaces
  2. ICE-3393

Eliminate unnecessary UIComponent.getChildren() calls

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.8DR#1, 1.8
    • Component/s: Framework, ICE-Components
    • Labels:
      None
    • Environment:
      JSP and Facelets

      Description

      In JSF 1.1 there are the following related methods in UIComponent:

      int getChildCount()
      java.util.List getChildren()
      javax.faces.component.UIComponent getFacet(java.lang.String name)
      java.util.Map getFacets()
      java.util.Iterator getFacetsAndChildren()

      JSF 1.2 adds the following:

      int getFacetCount()

      In UIComponent, there is the List of children, and the Map of facets. Both of these are only allocated as needed. The problem is that their getter accessors guarantee to return a non-null List and Map, respectively. So, even if a component has no children, nor any facets, just calling getChildren() or getFacets() will now take up memory. In JSF 1.2, they audited their code, and replaced any access to their children with a call to if( getChildCount() > 0) { getChildren() ... }. Similarly, even though we may not be able to use getFacetCount(), we should prefer calling getFacet(key) instead of getFacets().get(key).

      In order for this to make a difference, we have to fix EVERY SINGLE access of the children and facets. With modern IDEs this should be straight-forward.

        Issue Links

          Activity

          Mark Collette created issue -
          Mark Collette made changes -
          Field Original Value New Value
          Assignee Deryk Sinotte [ deryk.sinotte ]
          Ken Fyten made changes -
          Link This issue blocks ICE-3082 [ ICE-3082 ]
          Deryk Sinotte made changes -
          Assignee Deryk Sinotte [ deryk.sinotte ] Ken Fyten [ ken.fyten ]
          Ken Fyten made changes -
          Fix Version/s 1.7.2 [ 10130 ]
          Assignee Priority P1
          Assignee Ken Fyten [ ken.fyten ] Adnan Durrani [ adnan.durrani ]
          Adnan Durrani made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Adnan Durrani made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 1.7.2RC1 [ 10140 ]
          Fix Version/s 1.7.2 [ 10130 ]
          Ken Fyten made changes -
          Fix Version/s 1.8DR#1 [ 10141 ]
          Fix Version/s 1.7.2RC1 [ 10140 ]
          Ken Fyten made changes -
          Fix Version/s 1.8 [ 10161 ]
          Assignee Priority P1
          Ken Fyten made changes -
          Security Private [ 10001 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Adnan Durrani [ adnan.durrani ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Mark Collette
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: