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

[PERF] Review UIData.saveDescendantComponentStates and restoreDescendantComponentStates

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.6-SNAPSHOT
    • 2.0.6, 2.1.0
    • General
    • None
    • myfaces core trunk

    Description

      In my test case, method UIData.saveDescendantComponentStates allocates ~ 310 000 instances during one request/response. Most of them are empty List (+ Object []) and AbstractList$Itr

      Problems:

      1) The current code reminds me the old state saving style from JSF 1.X - a big table of (mostly empty) arrays.

      2) Using getChildren().iterator() creates new instance of AbstractList$Iter.

      3) Saving state of transient and state saving of EditableValueHolder: I don't see any mention of transient in setRowIndex JavaDoc.

      Suggestions:

      ad 1) JSF 2.0 and StateHelper is Map-based. Use map here or even the StateHelper directly. Create EditableValueHolderState instances only and not empty arrays and List. The saved state for a row with non-EditableValueHolder children must be null and must not allocate any objects.

      ad 2) Use the old fashion way with indices; that will avoid thousand of unnecessary iterators instances.

      ad 3) It seems that mojarra saves per-row state for every EVH, even for transients.

      Attachments

        1. MYFACES-3111.patch
          3 kB
          Martin Kočí

        Activity

          People

            lu4242 Leonardo Uribe
            markoc50 Martin Kočí
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: