myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Schwartz (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Comment Edited] (TRINIDAD-2447) UIComponent.isCompositeComponent() is slow for UIXComponents
Date Wed, 22 Jan 2014 17:09:22 GMT

    [ https://issues.apache.org/jira/browse/TRINIDAD-2447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878834#comment-13878834
] 

Andy Schwartz edited comment on TRINIDAD-2447 at 1/22/14 5:09 PM:
------------------------------------------------------------------

The proposed fix does two things:

1.  It optimizes ValueMap.containsKey() to use FacesBean.getRawProperty().
2.  It registers a PropertyKey for Resource.COMPONENT_RESOURCE_KEY.

#1 avoids the unnecessary key set creation.
#2 makes COMPONENT_RESOURCE_KEY an indexed property, thus allowing FlaggedPropertyMap to optimize
gets.


was (Author: andy.schwartz):
Proposed fix.

> UIComponent.isCompositeComponent() is slow for UIXComponents
> ------------------------------------------------------------
>
>                 Key: TRINIDAD-2447
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2447
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.1.0-core
>            Reporter: Andy Schwartz
>            Assignee: Andy Schwartz
>            Priority: Minor
>         Attachments: trinidad-2447.patch
>
>
> The JSF implementations hammer on UIComponent.isCompositeComponent () - eg. this is called
for each time the pushComponentToEL()/popComponentFromEL() methods are called, which is all
of the time.
> isCompositeComponent() performs the following check:
> component.getAttributes().containsKey(Resource.COMPONENT_RESOURCE_KEY);
> Unfortunately, this operation is slower than it should be for Trinidad-based UIXComponents.
 There reason for this is the non-optimal implementation of containsKey in Trinidad's ValueMap:
>   public boolean containsKey(Object key)
>   {
>     if (key == null)
>       throw new NullPointerException();
>     PropertyKey propertyKey = _getPropertyKey(key);
>     
>     if (_bean.keySet().contains(propertyKey))
>       return true;
>     else
>       return _bean.bindingKeySet().contains(propertyKey);    
>   }
> We're creating key sets for both the FacesBean properties and value expressions.  Aside
from the overhead of creating these key sets, this also means that we bypass optimizations
in FlaggedPropertyMap.
> This is showing up as a hot spot in JProfiler, so would like to see this optimized.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message