-
1. Re: Profiling the kernel project
smarlow Feb 11, 2010 3:45 PM (in response to kabirkhan)Last summer, we improved ScopeKey and introduced ScopeKey.getOptimizedKey() (which returns a UnmodifiableScopeKey). Some background is also on the forums here http://community.jboss.org/thread/96979?start=15&tstart=1
Anyway, we switched to UnmodifiableScopeKey in some places and still use the mutable ScopeKey in others. UnmodifiableScopeKey.equals performs faster when passed an UnmodifiableScopeKey, however there are still places that pass a mutable ScopeKey.
One way to quickly find/fix the different code sites that call UnmodifiableScopeKey.equals with a mutable ScopeKey, would be to instrument UnmodifiableScopeKey.equals() to call Thread.dumpStack() whenever the mixed case is hit (so you know which caller to fix). Or you could set a debugger breakpoint. Eliminating the mixed class type calls to equals should help (see timing later in above thread).
Further changes to improve ScopeKey and UnmodifiableScopeKey are of course welcome.
-
2. Re: Profiling the kernel project
kabirkhan Feb 11, 2010 5:32 PM (in response to smarlow)Thanks, I vaguely remembered that thread and was going to look for it in the morning. I've not yet looked at ScopeKey internals at all beyond what JProfiler tells me, I will do so tomorrow. Anyway, a lot of the overhead seems to be that the ScopeKey.toArray() call ends up calling Collection.toArray() every time. I am guessing it should be possible to cache the array somehow and invalidate as the scopes set is modified, but need to look at the usage first.
-
3. Re: Profiling the kernel project
kabirkhan Feb 12, 2010 6:22 AM (in response to kabirkhan)ScopeKey discussion continues here: http://community.jboss.org/message/526003#526003 -
4. Re: Profiling the kernel project
kabirkhan Feb 18, 2010 12:36 PM (in response to kabirkhan)A few other threads that have given some good results
Optimizing ControllerState: http://community.jboss.org/message/526380#526380
AnnotatedElementMetaDataLoader component metadata optimization: http://community.jboss.org/message/526629#526629
-
5. Re: Profiling the kernel project
kabirkhan Feb 18, 2010 12:41 PM (in response to kabirkhan)Changing CommonAnnotationAdapter to not always create iterators improves things a little bit:
e.g. things like
ClassInfo classInfo = info.getClassInfo(); - for (Annotation annotation : retrieval.getAnnotations()) + Annotation[] anns = retrieval.getAnnotations(); + for (int i = 0 ; i < anns.length ; i++) { - for(T plugin : getPlugins(ElementType.TYPE, annotation, null, annotationClasses)) + for(T plugin : getPlugins(ElementType.TYPE, anns[i], null, annotationClasses)) { if (isApplyPhase) - applyPlugin(plugin, annotation, classInfo, retrieval, handle); + applyPlugin(plugin, anns[i], classInfo, retrieval, handle); else - cleanPlugin(plugin, annotation, classInfo, retrieval, handle); + cleanPlugin(plugin, anns[i], classInfo, retrieval, handle); } }