Lajos Gáthy created WICKET-6351:
-----------------------------------

             Summary: Form.anyFormComponentError performance degradation
                 Key: WICKET-6351
                 URL: https://issues.apache.org/jira/browse/WICKET-6351
             Project: Wicket
          Issue Type: Improvement
    Affects Versions: 8.0.0-M4, 7.6.0
            Reporter: Lajos Gáthy
            Priority: Minor


This is related to the changes made in 
https://issues.apache.org/jira/browse/WICKET-5883

Inside the visitor instead of checking:

if (component.isVisibleInHierarchy() && component.isEnabledInHierarchy() && 
component.hasErrorMessage())

it would be much better to do:

if (component.hasErrorMessage() && component.isVisibleInHierarchy() && 
component.isEnabledInHierarchy())

This not only would save a lot of unnecessary computation when there is no 
error on a component (most cases) but computing isEnabled() or isVisible() is 
not trivial, but also would avoid reloading some detachable models too early 
(before models change after form submit). An example for the later: when we 
have a PagingNavigator where the PagingNavigationLink-s have autoEnable set to 
true (which is the default), then computing isEnabled() for these link would 
trigger model reload because PagingNavigationLink.linksTo(Page) needs 
getPageNumber(). Not only this, but it will make 
AbstractPageableView.getItemCount() cache the wrong itemCount (before model 
update happens) and return that on render phase incorrectly.

On the other hand I do not see any downside of changing the order of the 
conditions so that hasErrorMessage() is computed before others.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to