Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3461

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.7, 2.1.6
    • 2.0.13, 2.1.7
    • General
    • None

    Description

      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.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            arne.reinhardt Arne Reinhardt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified