You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Stevan Malesevic (JIRA)" <de...@myfaces.apache.org> on 2010/05/06 00:44:06 UTC
[jira] Created: (TRINIDAD-1805) UIXComponentBase
::invokeOnComponent should be optimized to avoid calls to getClientId
UIXComponentBase ::invokeOnComponent should be optimized to avoid calls to getClientId
--------------------------------------------------------------------------------------
Key: TRINIDAD-1805
URL: https://issues.apache.org/jira/browse/TRINIDAD-1805
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Reporter: Stevan Malesevic
UIXComponentBase ::invokeOnComponent is very expensive method and most of the cost comes from calls to getClientIds. The code can be optimized to avoid number of these calls
1. Before calling getClientId the code should do getId() and compare if passed in clientId ends with id
2. If this comp is naming container and its id is not part of passed in clientId then clientId is not under this container so skip invokeOnChildrenComponents
So code might look like this
@Override
public boolean invokeOnComponent(
FacesContext context,
String clientId,
ContextCallback callback)
throws FacesException
{
boolean invokedComponent;
// set up the context for visiting the children
setupVisitingContext(context);
try
{
//Check if pass in clientId ends with this id
//If not there is no matching
String id = this.getId();
if (clientId.endsWith(id) && clientId.equals(getClientId(context)))
{
pushComponentToEL(context, null);
try
{
// this is the component we want, so invoke the callback
callback.invokeContextCallback(context, this);
}
finally
{
popComponentFromEL(context);
}
// we found the component
invokedComponent = true;
}
else
{
//if this is naming container and passed in ClientId doesn't containe this id
//then there can not be a match on chiled comps
if ((this instanceof NamingContainer) && !(clientId.contains(id)))
invokedComponent = false;
else
// set up the children visiting context to iterate through children. We inline this
// code instead of calling super in order
// to avoid making an extra call to getClientId().
invokedComponent = invokeOnChildrenComponents(context, clientId, callback);
}
}
finally
{
// teardown the context now that we have visited the component
tearDownVisitingContext(context);
}
return invokedComponent;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1805) UIXComponentBase
::invokeOnComponent should be optimized to avoid calls to getClientId
Posted by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864792#action_12864792 ]
Andrew Robinson commented on TRINIDAD-1805:
-------------------------------------------
I thought we were now caching client IDs so is this still necessary?
> UIXComponentBase ::invokeOnComponent should be optimized to avoid calls to getClientId
> --------------------------------------------------------------------------------------
>
> Key: TRINIDAD-1805
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1805
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components
> Reporter: Stevan Malesevic
>
> UIXComponentBase ::invokeOnComponent is very expensive method and most of the cost comes from calls to getClientIds. The code can be optimized to avoid number of these calls
> 1. Before calling getClientId the code should do getId() and compare if passed in clientId ends with id
> 2. If this comp is naming container and its id is not part of passed in clientId then clientId is not under this container so skip invokeOnChildrenComponents
> So code might look like this
> @Override
> public boolean invokeOnComponent(
> FacesContext context,
> String clientId,
> ContextCallback callback)
> throws FacesException
> {
> boolean invokedComponent;
>
> // set up the context for visiting the children
> setupVisitingContext(context);
> try
> {
> //Check if pass in clientId ends with this id
> //If not there is no matching
> String id = this.getId();
>
> if (clientId.endsWith(id) && clientId.equals(getClientId(context)))
> {
> pushComponentToEL(context, null);
> try
> {
> // this is the component we want, so invoke the callback
> callback.invokeContextCallback(context, this);
> }
> finally
> {
> popComponentFromEL(context);
> }
> // we found the component
> invokedComponent = true;
> }
> else
> {
> //if this is naming container and passed in ClientId doesn't containe this id
> //then there can not be a match on chiled comps
> if ((this instanceof NamingContainer) && !(clientId.contains(id)))
> invokedComponent = false;
> else
> // set up the children visiting context to iterate through children. We inline this
> // code instead of calling super in order
> // to avoid making an extra call to getClientId().
> invokedComponent = invokeOnChildrenComponents(context, clientId, callback);
> }
> }
> finally
> {
> // teardown the context now that we have visited the component
> tearDownVisitingContext(context);
> }
> return invokedComponent;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (TRINIDAD-1805) UIXComponentBase
::invokeOnComponent should be optimized to avoid calls to getClientId
Posted by "Stevan Malesevic (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/TRINIDAD-1805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864796#action_12864796 ]
Stevan Malesevic commented on TRINIDAD-1805:
--------------------------------------------
Caching is not officially there yet and it is only on trunk. This is to optimize existing code. I am looking for this change in 1.2.12.3 branch
> UIXComponentBase ::invokeOnComponent should be optimized to avoid calls to getClientId
> --------------------------------------------------------------------------------------
>
> Key: TRINIDAD-1805
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1805
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components
> Reporter: Stevan Malesevic
>
> UIXComponentBase ::invokeOnComponent is very expensive method and most of the cost comes from calls to getClientIds. The code can be optimized to avoid number of these calls
> 1. Before calling getClientId the code should do getId() and compare if passed in clientId ends with id
> 2. If this comp is naming container and its id is not part of passed in clientId then clientId is not under this container so skip invokeOnChildrenComponents
> So code might look like this
> @Override
> public boolean invokeOnComponent(
> FacesContext context,
> String clientId,
> ContextCallback callback)
> throws FacesException
> {
> boolean invokedComponent;
>
> // set up the context for visiting the children
> setupVisitingContext(context);
> try
> {
> //Check if pass in clientId ends with this id
> //If not there is no matching
> String id = this.getId();
>
> if (clientId.endsWith(id) && clientId.equals(getClientId(context)))
> {
> pushComponentToEL(context, null);
> try
> {
> // this is the component we want, so invoke the callback
> callback.invokeContextCallback(context, this);
> }
> finally
> {
> popComponentFromEL(context);
> }
> // we found the component
> invokedComponent = true;
> }
> else
> {
> //if this is naming container and passed in ClientId doesn't containe this id
> //then there can not be a match on chiled comps
> if ((this instanceof NamingContainer) && !(clientId.contains(id)))
> invokedComponent = false;
> else
> // set up the children visiting context to iterate through children. We inline this
> // code instead of calling super in order
> // to avoid making an extra call to getClientId().
> invokedComponent = invokeOnChildrenComponents(context, clientId, callback);
> }
> }
> finally
> {
> // teardown the context now that we have visited the component
> tearDownVisitingContext(context);
> }
> return invokedComponent;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.