You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2013/09/15 18:59:51 UTC

[jira] [Created] (MYFACES-3774) [perf] use facetName as a hint when try to find a component on refresh view algorithm

Leonardo Uribe created MYFACES-3774:
---------------------------------------

             Summary: [perf] use facetName as a hint when try to find a component on refresh view algorithm
                 Key: MYFACES-3774
                 URL: https://issues.apache.org/jira/browse/MYFACES-3774
             Project: MyFaces Core
          Issue Type: Improvement
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe
            Priority: Minor


Checking some stuff I realized in ComponentTagHandlerDelegate.apply(...), the following instructions are done when the view requires refresh in render response phase:

                 String facetName = this.getFacetName(ctx, parent);

....

                c = ComponentSupport.findChildByTagId(parent, id);

....

                if (facetName == null)
                {
                    parent.getChildren().remove(c);
                }
                else
                {
                    ComponentSupport.removeFacet(ctx, parent, c, facetName);
                }

....


        if (facetName == null)
        {
            parent.getChildren().add(c);
        }
        else
        {
            ComponentSupport.addFacet(ctx, parent, c, facetName);
        }

The thing is if facetName == null the component will always be as a children. If facetName != null, the component will always be in the facet associated to that name. But the code in findChildByTagId(...) always look on the children first and then in all facets using an iterator, which is just overkill. 

It is better if we split findChildByTagId(...) into two variants (findChildInFacetByTagId and findChildInChildrenByTagId) and use the facetName as the condition and to get the right one if the component is in the facet. That will save 1 iterator instance per facet and a lot of unnecessary component.getAttributes().get(...) calls. But from the other side, myfaces algorithm is smart enough to avoid view refreshing at all, so the improvement will only be seen in some selected situations. Anyway, it is worth to do it for 2.2.x branch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira