[
https://issues.apache.org/jira/browse/MYFACES-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13051172#comment-13051172
]
Leonardo Uribe commented on MYFACES-3144:
-----------------------------------------
I think there is one alternative to do this. To retrieve a renderer we need
three params:
1. renderKitId
2. family
3. rendererType
family and rendererType does not change, but renderKitId could change. So, why
don't save on a transient field the latest renderKitId used to derive the
renderer? Then, when getRenderer() is called we just compare that field against
the current one and if are equals we can return the cached instance, otherwise
recalculate it.
But anyway it is questionable if we can gain something with this strategy,
because in practice we replace a simple comparison between two strings + an
additional field on every component against two lookups over a map. At first
view, let the code "as is" looks good, so only if we can gain something it is
worth to do it.
> [PERF] Cache renderer in UIComponentBase
> ----------------------------------------
>
> Key: MYFACES-3144
> URL: https://issues.apache.org/jira/browse/MYFACES-3144
> Project: MyFaces Core
> Issue Type: New Feature
> Components: General
> Affects Versions: 2.1.0-SNAPSHOT
> Environment: myfaces core trunk
> Reporter: Martin Kočí
> Assignee: Martin Kočí
> Attachments: MYFACES-3144.patch
>
>
> UIComponentBase uses getRenderer(): Renderer in five methods:
> 1) decode
> 2) encodeBegin
> 3) encodeChildren
> 4) encodeEnd
> 50 getClientId
> getting the renderer is not cheap if you have thousands component in view.
> Cache renderer instance in UIComponentBase (Trinidad UIXComponentBase does it
> already)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira