MyFaces Core
  1. MyFaces Core
  2. MYFACES-3418

[perf] do not check for duplicate ids when saving view on production stage

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.12, 2.1.6
    • Component/s: None
    • Labels:
      None
    • Environment:
      myfaces trunk
    1. MYFACES-3418-final-1.patch
      9 kB
      Leonardo Uribe
    2. MYFACES-3418-alternative-1.patch
      6 kB
      Leonardo Uribe
    3. MYFACES-3418.patch
      3 kB
      Martin Kočí

      Activity

      Leonardo Uribe made changes -
      Status Resolved [ 5 ] Closed [ 6 ]
      Leonardo Uribe made changes -
      Status Patch Available [ 10002 ] Resolved [ 5 ]
      Fix Version/s 2.0.12 [ 12319175 ]
      Fix Version/s 2.1.6 [ 12319173 ]
      Resolution Fixed [ 1 ]
      Hide
      Leonardo Uribe added a comment -

      Attached final patch. Changed param name to org.apache.myfaces.CHECK_ID_PRODUCTION_MODE with this description:

      /**

      • Define how duplicate ids are checked when ProjectStage is Production, by default (auto) it only check ids of
      • components that does not encapsulate markup (like facelets UILeaf).
      • <ul>
      • <li>true: check all ids, including ids for components that are transient and encapsulate markup.</li>
      • <li>auto: (default) check ids of components that does not encapsulate markup (like facelets UILeaf).
      • Note ids of UILeaf instances are generated by facelets vdl, start with "j_id", are never rendered
      • into the response and UILeaf instances are never used as a target for listeners, so in practice
      • there is no need to check such ids. This reduce the overhead associated with generate client ids.</li>
      • <li>false: do not do any check when ProjectStage is Production</li>
      • </ul>
      • <p> According to specification, identifiers must be unique within the scope of the nearest ancestor to
      • the component that is a naming container.</p>
        */
      Show
      Leonardo Uribe added a comment - Attached final patch. Changed param name to org.apache.myfaces.CHECK_ID_PRODUCTION_MODE with this description: /** Define how duplicate ids are checked when ProjectStage is Production, by default (auto) it only check ids of components that does not encapsulate markup (like facelets UILeaf). <ul> <li>true: check all ids, including ids for components that are transient and encapsulate markup.</li> <li>auto: (default) check ids of components that does not encapsulate markup (like facelets UILeaf). Note ids of UILeaf instances are generated by facelets vdl, start with "j_id", are never rendered into the response and UILeaf instances are never used as a target for listeners, so in practice there is no need to check such ids. This reduce the overhead associated with generate client ids.</li> <li>false: do not do any check when ProjectStage is Production</li> </ul> <p> According to specification, identifiers must be unique within the scope of the nearest ancestor to the component that is a naming container.</p> */
      Leonardo Uribe made changes -
      Attachment MYFACES-3418-final-1.patch [ 12510378 ]
      Hide
      Leonardo Uribe added a comment -

      I did another alternative for this one. The idea is do not take into account ids from components descending UILeaf (html markup) in production by default and do not use the parameter. Maybe we can combine both strategies, allowing org.apache.myfaces.CHECK_ID_IN_PRODUCTION with these values:

      true : Check all client ids, including UILeaf components
      auto : Check only client ids of components that does not extends from UILeaf.
      false : Do not check for duplicate ids in production.

      I think the advantage of the "auto" mode is that improve performance and reduce memory usage, and catch all duplicate id relevant cases (remember that facelets generates ids always starting with j_id_ , which is a reserved prefix for generated ids).

      If no objections I'll combine both patches and commit the resulting code soon.

      Show
      Leonardo Uribe added a comment - I did another alternative for this one. The idea is do not take into account ids from components descending UILeaf (html markup) in production by default and do not use the parameter. Maybe we can combine both strategies, allowing org.apache.myfaces.CHECK_ID_IN_PRODUCTION with these values: true : Check all client ids, including UILeaf components auto : Check only client ids of components that does not extends from UILeaf. false : Do not check for duplicate ids in production. I think the advantage of the "auto" mode is that improve performance and reduce memory usage, and catch all duplicate id relevant cases (remember that facelets generates ids always starting with j_id_ , which is a reserved prefix for generated ids). If no objections I'll combine both patches and commit the resulting code soon.
      Leonardo Uribe made changes -
      Attachment MYFACES-3418-alternative-1.patch [ 12510296 ]
      Martin Kočí made changes -
      Status Open [ 1 ] Patch Available [ 10002 ]
      Martin Kočí made changes -
      Field Original Value New Value
      Attachment MYFACES-3418.patch [ 12506993 ]
      Hide
      Martin Kočí added a comment -

      suggested patch; introduces new param org.apache.myfaces.CHECK_ID_IN_PRODUCTION; (in future can be used for UIComponentBase.isIdValid too)

      Show
      Martin Kočí added a comment - suggested patch; introduces new param org.apache.myfaces.CHECK_ID_IN_PRODUCTION; (in future can be used for UIComponentBase.isIdValid too)
      Martin Kočí created issue -

        People

        • Assignee:
          Martin Kočí
          Reporter:
          Martin Kočí
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development