HtmlRendererUtils.renderSelectOptions() performs many unnecessary calls to View 
Bean
------------------------------------------------------------------------------------

                 Key: MYFACES-3461
                 URL: https://issues.apache.org/jira/browse/MYFACES-3461
             Project: MyFaces Core
          Issue Type: Improvement
          Components: General
    Affects Versions: 2.1.6, 2.0.7
            Reporter: Arne Reinhardt
            Priority: Minor


The Problem appeared testing with myfaces-impl-2.0.7 and is still visible in 
the 2.1.6 Code.

HtmlRendererUtils.renderSelectOptions() loops over all SelectItems of a 
SelectBox to render them.
Rendering depends on the activation state of both the item to be rendered and 
the entire SelectBox. Therefore the method queries the "diasbled" property of 
the UI component to be rendered (SelectBox). This is performed in the 
SelectItem-Loop so it may happen very often (depending on the size of the 
Select-List).
It happens that queriing the "disabled" property implies calling the ViewBean 
to obtain the SelectItem-List (which the Method itself loops over!). This can 
be a perfromance issue if obtaining the SelectItem-List takes some time (in our 
example every single call  took 10ms and the list consisted of 150 items so the 
call was performed 150 times which adds up to 1.5s). Anyway there is a lot of 
unnecessary Reflection and Method Calls to be avoided.

We solved the issue by simply moving the detection of the UI component's 
"disabled"-Property out of the loop.

--
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