myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (Created) (JIRA)" <>
Subject [jira] [Created] (MYFACES-3487) [perf] cache unique ids generated by facelets
Date Sun, 04 Mar 2012 00:07:58 GMT
[perf] cache unique ids generated by facelets

                 Key: MYFACES-3487
             Project: MyFaces Core
          Issue Type: Improvement
          Components: JSR-314
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe
         Attachments: MYFACES-3487-1.patch

It could be good to cache unique ids and reduce the impact in memory such generation has in
memory. It is possible to cache:

1. The generated unique ids at level 0 per view. If the view is not dinamic the generated
list will always be the same, but it will change per view. The ideal is store it in a volatile
2. The component unique ids passed to generate later an unique id in UniqueIdVendor.createUniqueId().
By the spec it is not possible to hook createUniqueId, but we can reuse for that counter the
generated values "at level 0" (which means for components that are not in a dynamic part).

It is possible to use FaceletCompositionContext.startComponentUniqueIdSection(), to indicate
the "level 0" where all unique ids will be generated whithout change.

The cache proposed in 2. can be enabled by default, because it is something more related to
the counter, but the cache for 1. it is too risky. I tried by default and it pass all tests,
but for now I'll let it by default false to prevent problems.

 The proposal is add these two params:

     * Enable or disable a cache used to "remember" the generated facelets unique ids and
     * the impact on memory usage, only active if javax.faces.FACELETS_REFRESH_PERIOD is -1
(no refresh).
    @JSFWebConfigParam(defaultValue = "false", since = "2.0.13, 2.1.7", expectedValues="true,
            group="viewhandler", tags="performance",
            desc="Enable or disable a cache used to 'remember'  the generated facelets unique
ids " + 
                 "and reduce the impact over memory usage.")
    public static final String INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED = 
    public static final boolean INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT = false;
     * Set the size of the cache used to store strings generated using SectionUniqueIdCounter
     * for component ids. If this is set to 0, no cache is used. By default is set to 100.
    @JSFWebConfigParam(defaultValue = "100", since = "2.0.13, 2.1.7",
            group="viewhandler", tags="performance")
    public static final String INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE =

If no objections I'll commit the solution proposed soon.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message