[jboss-cvs] JBossAS SVN: r101129 - in projects/kernel/trunk/kernel/src: test/java/org/jboss/test/kernel/benchmark/support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 18 12:43:56 EST 2010
Author: kabir.khan at jboss.com
Date: 2010-02-18 12:43:56 -0500 (Thu, 18 Feb 2010)
New Revision: 101129
Added:
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/StartStopObjectWithLotsofMethods.java
projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/StartStopObjectWithLotsOfMethodsBenchmark.java
Modified:
projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
Log:
[JBKERNEL-95] More benchmarks, don't always create iterators in CommonAnnotationAdapter if there are no annotations
Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2010-02-18 17:42:24 UTC (rev 101128)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java 2010-02-18 17:43:56 UTC (rev 101129)
@@ -410,17 +410,17 @@
// class
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);
}
}
-
//Meta annotations on class
Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = getMetaAnnotationsForType(ElementType.TYPE);
if (metaAnnotationsForType != null)
@@ -450,14 +450,15 @@
MetaData cmdr = retrieval.getComponentMetaData(cis);
if (cmdr != null)
{
- for (Annotation annotation : cmdr.getAnnotations())
+ Annotation[] canns = cmdr.getAnnotations();
+ for (int i = 0 ; i < canns.length ; i++)
{
- for(T plugin : getPlugins(ElementType.CONSTRUCTOR, annotation, null, annotationClasses))
+ for(T plugin : getPlugins(ElementType.CONSTRUCTOR, canns[i], null, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, annotation, ci, cmdr, handle);
+ applyPlugin(plugin, canns[i], ci, cmdr, handle);
else
- cleanPlugin(plugin, annotation, ci, cmdr, handle);
+ cleanPlugin(plugin, canns[i], ci, cmdr, handle);
}
}
}
@@ -483,14 +484,15 @@
MetaData cmdr = retrieval.getComponentMetaData(sis);
if (cmdr != null)
{
- for (Annotation annotation : cmdr.getAnnotations())
+ Annotation[] canns = cmdr.getAnnotations();
+ for (int i = 0 ; i < canns.length ; i++)
{
- for(T plugin : getPlugins(ElementType.FIELD, annotation, null, annotationClasses))
+ for(T plugin : getPlugins(ElementType.FIELD, canns[i], null, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, annotation, field, cmdr, handle);
+ applyPlugin(plugin, canns[i], field, cmdr, handle);
else
- cleanPlugin(plugin, annotation, field, cmdr, handle);
+ cleanPlugin(plugin, canns[i], field, cmdr, handle);
}
}
}
@@ -523,14 +525,15 @@
MetaData cmdr = retrieval.getComponentMetaData(mis);
if (cmdr != null)
{
- for (Annotation annotation : cmdr.getAnnotations())
+ Annotation[] canns = cmdr.getAnnotations();
+ for (int i = 0 ; i < canns.length ; i++)
{
- for(T plugin : getPlugins(ElementType.METHOD, annotation, METHOD_FILTER, annotationClasses))
+ for(T plugin : getPlugins(ElementType.METHOD, canns[i], METHOD_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, annotation, mi, cmdr, handle);
+ applyPlugin(plugin, canns[i], mi, cmdr, handle);
else
- cleanPlugin(plugin, annotation, mi, cmdr, handle);
+ cleanPlugin(plugin, canns[i], mi, cmdr, handle);
}
}
}
@@ -554,14 +557,15 @@
MetaData cmdr = retrieval.getComponentMetaData(mis);
if (cmdr != null)
{
- for (Annotation annotation : cmdr.getAnnotations())
+ Annotation[] canns = cmdr.getAnnotations();
+ for (int i = 0 ; i < canns.length ; i++)
{
- for(T plugin : getPlugins(ElementType.METHOD, annotation, METHOD_FILTER, annotationClasses))
+ for(T plugin : getPlugins(ElementType.METHOD, canns[i], METHOD_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, annotation, smi, cmdr, handle);
+ applyPlugin(plugin, canns[i], smi, cmdr, handle);
else
- cleanPlugin(plugin, annotation, smi, cmdr, handle);
+ cleanPlugin(plugin, canns[i], smi, cmdr, handle);
}
}
}
@@ -610,14 +614,15 @@
MetaData cmdr = retrieval.getComponentMetaData(sis);
if (cmdr != null)
{
- for (Annotation annotation : cmdr.getAnnotations())
+ Annotation[] canns = cmdr.getAnnotations();
+ for (int i = 0 ; i < canns.length ; i++)
{
- for(T plugin : getPlugins(ElementType.METHOD, annotation, PROPERTY_FILTER, annotationClasses))
+ for(T plugin : getPlugins(ElementType.METHOD, canns[i], PROPERTY_FILTER, annotationClasses))
{
if (isApplyPhase)
- applyPlugin(plugin, annotation, pi, cmdr, handle);
+ applyPlugin(plugin, canns[i], pi, cmdr, handle);
else
- cleanPlugin(plugin, annotation, pi, cmdr, handle);
+ cleanPlugin(plugin, canns[i], pi, cmdr, handle);
}
}
}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/StartStopObjectWithLotsofMethods.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/StartStopObjectWithLotsofMethods.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/support/StartStopObjectWithLotsofMethods.java 2010-02-18 17:43:56 UTC (rev 101129)
@@ -0,0 +1,84 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.benchmark.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartStopObjectWithLotsofMethods
+{
+ public boolean started;
+ public boolean created;
+
+ public void method1() {}
+ public void method2() {}
+ public void method3() {}
+ public void method4() {}
+ public void method5() {}
+ public void method6() {}
+ public void method7() {}
+ public void method8() {}
+ public void method9() {}
+ public void method10() {}
+ public void method11() {}
+ public void method12() {}
+ public void method13() {}
+ public void method14() {}
+ public void method15() {}
+ public void method16() {}
+ public void method17() {}
+ public void method18() {}
+ public void method19() {}
+ public void method20() {}
+ public void method21() {}
+ public void method22() {}
+ public void method23() {}
+ public void method24() {}
+ public void method25() {}
+ public void method26() {}
+ public void method27() {}
+ public void method28() {}
+ public void method29() {}
+ public void method30() {}
+ public void method31() {}
+ public void method32() {}
+ public void method33() {}
+ public void method34() {}
+ public void method35() {}
+ public void method36() {}
+ public void method37() {}
+ public void method38() {}
+ public void method39() {}
+
+ public void start()
+ {
+ started = true;
+ }
+
+ public void create()
+ {
+ created = true;
+ }
+
+}
Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/StartStopObjectWithLotsOfMethodsBenchmark.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/StartStopObjectWithLotsOfMethodsBenchmark.java (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/benchmark/test/StartStopObjectWithLotsOfMethodsBenchmark.java 2010-02-18 17:43:56 UTC (rev 101129)
@@ -0,0 +1,65 @@
+
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.benchmark.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.test.kernel.benchmark.support.StartStopObjectWithLotsofMethods;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class StartStopObjectWithLotsOfMethodsBenchmark extends AbstractBenchmark
+{
+ public StartStopObjectWithLotsOfMethodsBenchmark(String name)
+ {
+ super(name);
+ super.iterations = 1000;
+ }
+
+ @Override
+ protected List<BeanMetaData> setupContexts()
+ {
+ List<BeanMetaData> beans = new ArrayList<BeanMetaData>(iterations);
+ for (int i = 0 ; i < iterations ; i++)
+ {
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("Bean" + i, StartStopObjectWithLotsofMethods.class.getName());
+ beans.add(builder.getBeanMetaData());
+ }
+ return beans;
+ }
+
+ @Override
+ protected void extraCheck(ControllerContext ctx)
+ {
+ StartStopObjectWithLotsofMethods obj = (StartStopObjectWithLotsofMethods)ctx.getTarget();
+ assertTrue(obj.started);
+ assertTrue(obj.created);
+ }
+}
More information about the jboss-cvs-commits
mailing list