JBoss development,
A new message was posted in the thread "Optimizing ScopeKey":
http://community.jboss.org/message/526003#526003
Author : Kabir Khan
Profile :
http://community.jboss.org/people/kabir.khan@jboss.com
Message:
--------------------------------------------------------------
From
http://community.jboss.org/message/525925#525925
Running a very simple benchmark for deploying a 1000 beans of type Object with no
dependencies or configured properties, i.e.
*protected* List<BeanMetaData> setupContexts()
{
List<BeanMetaData> beans = *new* ArrayList<BeanMetaData>(iterations);
*for* (*int* i = 0 ; i < iterations ; i++)
{
BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean"
+ i, Object.class.getName());
beans.add(builder.getBeanMetaData());
}
*return* beans;
}
shows 85% of this time to be spent in the PreInstallAction. A similar test deploying 500
beans with dependencies in the wrong order (which we know from
http://community.jboss.org/message/525809#525809 is very slow) shows 25% of the time spent
in PreInstallAction.
Most of the time spent in PreInstallAction comes down to adding to and reading from the
BasicMetaDataRepository.retrievals map, which hits UnmodifiableScopeKey.equals lots of
times (~2M times in the 1000 beans case):
*public* *boolean* equals(Object object)
{
*if* (object == *this*)
*return* *true*;
*if* (object == *null* || object *instanceof* ScopeKey == *false*)
*return* *false*;
ScopeKey other = (ScopeKey) object;
Scope[] otherArray = other.getArray();
*return* Arrays.equals(theScopes, otherArray);
}
I will dig into this tomorrow and see if this can be optimized somehow, and if it is a
problem in MDR I'll open another thread for that.
1001 puts into BasicMetaDataRepository.retrievals results in 499500 UnmodifiableScopeKey
calls. That is the sum of all numbers from 1 to 999, so it seems like the hashing is not
working properly and that we iterate over all entries when doing a put to check if they
exist.
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/526003#526003