[PERF] Renderers for components like h:outputText and others do many unecessary
getAttributes().get() calls
-----------------------------------------------------------------------------------------------------------
Key: MYFACES-3237
URL: https://issues.apache.org/jira/browse/MYFACES-3237
Project: MyFaces Core
Issue Type: Improvement
Components: JSR-314
Reporter: Leonardo Uribe
Doing some performance tests with Gerhard, we notice renderers like the one
used for h:outputText does a lot of calls to getAttributes().get().
The problem is most of this calls just return null, wasting time and resources.
For example, usually h:outputText uses value, style and styleClass. Think about
the most basic use case where you need to show some data with just h:dataTable
and h:outputText. Per each h:outputText, 6 calls to getAttributes().get() for
passthrough attributes, most of them completely unnecessary. The same is true
for other components.
We can reduce the number of calls if we have something that keep track of the
properties already set. Obviously this will be a myfaces internal, but I think
it is worth to do it at least for the most used components like h:outputText,
h:outputLabel, h:outputFormat, h:outputScript and h:outputStylesheet. Note do
this can make renderers harder to maintain, because some extra code should be
added.
We already have some interfaces in javax.faces.component.html package like
_StyleProperties
_UniversalProperties
_TitleProperty
_EscapeProperty
_DisabledClassEnabledClassProperties
_DisabledReadonlyProperties
_AccesskeyProperty
_AltProperty
_ChangeSelectProperties
_EventProperties
_FocusBlurProperties
_LabelProperty
_LinkProperties
_MessageProperties
_TabindexProperty
The idea could be focus only on these set of properties, and let the others as
is.
Long time ago, when I reviewed trinidad code for implement MyFaces Core Partial
State Saving, I notice the class org.apache.myfaces.trinidad.bean.PropertyKey
has an algorithm that assign a number to each property. Maybe we can assign a
number to each property and store a flag on attribute map when it is set, and
then retrieve this value from the renderer and only check the ones that needs
to be rendered.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira