[jboss-user] [JBoss Microcontainer Development] New message: "Re: Profiling the dependency project"
Kabir Khan
do-not-reply at jboss.com
Wed Feb 10 08:24:58 EST 2010
User development,
A new message was posted in the thread "Profiling the dependency project":
http://community.jboss.org/message/525413#525413
Author : Kabir Khan
Profile : http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
One thing that is taking a lot of time in the wrong order benchmark is in AbstractDependencyItem.resolve(). Since the dependentState is null we end up doing this:
public boolean resolve(Controller controller)
{
boolean previous = resolved;
ControllerContext context;
if (dependentState == null)
context = controller.getInstalledContext(iDependOn);
else
{
context = controller.getContext(iDependOn, dependentState); //<<<< Here
if (context == null)
{
if (ControllerState.INSTALLED.equals(dependentState))
context = controller.getInstalledContext(iDependOn); //<<<< Here
}
}
if (context == null)
{
resolved = false;
ControllerContext unresolvedContext = controller.getContext(iDependOn, null); //<<<< Here
if (unresolvedContext != null && ControllerMode.ON_DEMAND.equals(unresolvedContext.getMode()))
{
try
{
controller.enableOnDemand(unresolvedContext);
}
catch (Throwable ignored)
{
if (log.isTraceEnabled())
log.trace("Unexpected error", ignored);
}
}
}
else
{
addDependsOnMe(controller, context);
resolved = true;
}
These calls account for about 50% of the time spent.
Changing to:
context = controller.getContext(iDependOn, dependentState); //<<<< Here
//if (context == null)
//{
// if (ControllerState.INSTALLED.equals(dependentState))
// context = controller.getInstalledContext(iDependOn); //<<<< Here
//}
Gives a perfomance boost to the wrong order test of about 15%. I have committed this.
What I would really like is to be able to is somehow roll the getting of the context and the on demand context into one, something along the lines of
public boolean resolve(Controller controller)
{
boolean previous = resolved;
ControllerState state = dependentState == null ? ControllerState.INSTALLED : dependentState;
ControllerContext context = controller.getContextAtStateOrEnableOnDemand(iDependOn, state);
if (context == null)
{
resolved = false;
}
else
{
addDependsOnMe(controller, context);
resolved = true;
}
}
That way we only query for the context once instead of twice (three times before my last change)
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/525413#525413
More information about the jboss-user
mailing list