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

          Hide
          Deryk Sinotte added a comment -

          Marking for re-assignment to component team.

          Show
          Deryk Sinotte added a comment - Marking for re-assignment to component team.
          Hide
          Adnan Durrani added a comment -

          Changes made to the following classes, so the getChildren() was only called when the getChildCount > 0

          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginatorRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\taglib\Util.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapMarker.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItem.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItems.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputmedia\OutputMediaRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsibleRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelpositioned\PanelPositionedRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelseries\PanelSeriesRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputText.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\Tree.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\CheckboxRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GridRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GroupRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\TableRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsibleRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapMarker.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelseries\PanelSeriesRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItem.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\taglib\Util.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelpositioned\PanelPositionedRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginatorRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputmedia\OutputMediaRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GridRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\CheckboxRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\TableRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\Tree.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItems.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GroupRenderer.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputText.java
          Completed: At revision: 17491

          Show
          Adnan Durrani added a comment - Changes made to the following classes, so the getChildren() was only called when the getChildCount > 0 Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginatorRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\taglib\Util.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapMarker.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItem.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItems.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputmedia\OutputMediaRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsibleRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelpositioned\PanelPositionedRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelseries\PanelSeriesRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputText.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\Tree.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\CheckboxRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GridRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GroupRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\TableRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelcollapsible\PanelCollapsibleRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapMarker.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\MenuRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelseries\PanelSeriesRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\OutputMessageRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItem.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\taglib\Util.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\panelpositioned\PanelPositionedRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginatorRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputmedia\OutputMediaRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\DomBasicRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\application\D2DViewHandler.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GridRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\CheckboxRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\TableRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\Tree.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\inputfile\InputFile.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\menubar\MenuItems.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\gmap\GMapRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\core\src\com\icesoft\faces\renderkit\dom_html_basic\GroupRenderer.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\paneltabset\PanelTabSet.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\selectinputtext\SelectInputText.java Completed: At revision: 17491
          Hide
          Adnan Durrani added a comment -

          All getFacets().get(key) calls replaced with getFacet(key).

          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginator.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java
          Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\TreeNode.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\TreeNode.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginator.java
          Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java
          Completed: At revision: 17492

          Show
          Adnan Durrani added a comment - All getFacets().get(key) calls replaced with getFacet(key). Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginator.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java Modified: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\TreeNode.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\tree\TreeNode.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\HtmlDataTable.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\datapaginator\DataPaginator.java Sending content: D:\work\development\freshcopy\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\ext\UIColumns.java Completed: At revision: 17492

            People

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

              Dates

              • Created:
                Updated:
                Resolved: