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 2012/05/22 12:58:41 UTC

[jira] [Resolved] (MYFACES-3550) [perf] minimize FacesContext.getCurrentInstance() calls part II

     [ https://issues.apache.org/jira/browse/MYFACES-3550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3550.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.8
                   2.0.14
    
> [perf] minimize FacesContext.getCurrentInstance() calls part II
> ---------------------------------------------------------------
>
>                 Key: MYFACES-3550
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3550
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: JSR-314
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.14, 2.1.8
>
>
> It is still possible to minimize even more the number of calls to FacesContext.getCurrentInstance(), just doing some small changes in some methods.
> For example, Application.createComponent(String componentType) has an internal call to FacesContext.getCurrentInstance(), but the variant Application.createComponent(FacesContext context, String componentType, String rendererType) does not, because it can be retrieved from the parameter. Since rendererType can be null according to JSF spec, the result of both methods is equivalent, so it is possible to use the second variant and save one call per component that does not have rendererType.
> Other important place is when EL evaluation occur (FacesCompositeELResolver), FacesContext.getCurrentInstance() is always called, but it is preferred to get the FacesContext from the ELContext first, because a get over a map of 1 or 2 elements will be faster than a ThreadLocal lookup, which is proportional to the number of threads running.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira