Leonardo Uribe created MYFACES-3550:
---------------------------------------

             Summary: [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


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

        

Reply via email to