[jboss-dev-forums] [JBoss Microcontainer Development] - Re: Optimizing ControllerState

alesj do-not-reply at jboss.com
Wed Oct 14 12:10:38 EDT 2009


"adrian at jboss.org" wrote : There's also a simple optimization you can add to ControllerState.equals()
  | Currently it will be doing a string comparison even when the comparison is with itself. :-(
  | 
  | 
  |   |    public boolean equals(Object object)
  |   |    {
  |   | +      if (object == this)
  |   | +         return true;
  |   |       if (object == null || object instanceof ControllerState == false)
  |   |          return false;
  |   |       ControllerState other = (ControllerState) object;
  |   |       return stateString.equals(other.stateString);
  |   |    }
  |   | 
I think I tried this one + doing a check on state string's hash 
(checking actual string only if hash's matched; same hash != same state),
but it didn't visible speed things, hence more drastic change is wip.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260354#4260354

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260354



More information about the jboss-dev-forums mailing list