Author: mcucchiara Date: Fri Oct 28 16:51:29 2011 New Revision: 1190443 URL: http://svn.apache.org/viewvc?rev=1190443&view=rev Log: OGNL-31 - Added compiler performance test
Added: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/invocation/CompilerInvocation.java Modified: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/BasePerformanceTest.java commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/CommonsRuntimeWrapper.java commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/OldOgnlRuntimeWrapper.java commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/RuntimeWrapper.java Modified: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/BasePerformanceTest.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/BasePerformanceTest.java?rev=1190443&r1=1190442&r2=1190443&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/BasePerformanceTest.java (original) +++ commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/BasePerformanceTest.java Fri Oct 28 16:51:29 2011 @@ -25,6 +25,7 @@ import com.carrotsearch.junitbenchmarks. import com.carrotsearch.junitbenchmarks.BenchmarkRule; import com.carrotsearch.junitbenchmarks.annotation.AxisRange; import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart; +import org.apache.commons.ognl.performance.invocation.CompilerInvocation; import org.apache.commons.ognl.performance.invocation.FieldInvocation; import org.apache.commons.ognl.performance.invocation.FindParameterTypesInvocation; import org.apache.commons.ognl.performance.invocation.GetConstructorsInvocation; @@ -121,4 +122,12 @@ public abstract class BasePerformanceTes { new PrimitiveDefaultInvocation( runtimeWrapper, 100000 ); } + + @BenchmarkOptions( benchmarkRounds = 50, warmupRounds = 0, concurrency = 1000 ) + @Test + public void compiler( ) + throws Exception + { + new CompilerInvocation( runtimeWrapper, 100 ); + } } Added: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/invocation/CompilerInvocation.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/invocation/CompilerInvocation.java?rev=1190443&view=auto ============================================================================== --- commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/invocation/CompilerInvocation.java (added) +++ commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/invocation/CompilerInvocation.java Fri Oct 28 16:51:29 2011 @@ -0,0 +1,26 @@ +package org.apache.commons.ognl.performance.invocation; + +import org.apache.commons.ognl.performance.runtime.RuntimeWrapper; + +/** + * User: mcucchiara + * Date: 28/10/11 + * Time: 18.42 + */ +public class CompilerInvocation + extends RepeatableInvocation +{ + public CompilerInvocation( RuntimeWrapper runtimeWrapper, int times ) + throws Exception + { + super( runtimeWrapper, times ); + + } + + @Override + protected void invoke( Class<?> c ) + throws Exception + { + getRuntime().getCompiler(); + } +} Modified: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/CommonsRuntimeWrapper.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/CommonsRuntimeWrapper.java?rev=1190443&r1=1190442&r2=1190443&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/CommonsRuntimeWrapper.java (original) +++ commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/CommonsRuntimeWrapper.java Fri Oct 28 16:51:29 2011 @@ -110,4 +110,9 @@ public class CommonsRuntimeWrapper { OgnlRuntime.clearCache( ); } + + public void getCompiler() + { + OgnlRuntime.getCompiler(null); + } } Modified: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/OldOgnlRuntimeWrapper.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/OldOgnlRuntimeWrapper.java?rev=1190443&r1=1190442&r2=1190443&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/OldOgnlRuntimeWrapper.java (original) +++ commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/OldOgnlRuntimeWrapper.java Fri Oct 28 16:51:29 2011 @@ -34,79 +34,84 @@ import java.lang.reflect.Method; public class OldOgnlRuntimeWrapper implements RuntimeWrapper { - + public void getFields( Class<?> c ) throws Exception { OgnlRuntime.getFields( c ); } - + public void findParameterTypes( Class<?> targetClass, Method method ) throws Exception { OgnlRuntime.findParameterTypes( targetClass, method ); } - + public void getConstructors( Class<?> c ) throws Exception { OgnlRuntime.getConstructors( c ); } - + public void getMethods( Class<?> c, boolean staticMethods ) throws Exception { OgnlRuntime.getMethods( c, staticMethods ); } - + public void getDeclaredMethods( Class<?> c, String propertyName, boolean setters ) throws Exception { OgnlRuntime.getDeclaredMethods( c, propertyName, setters ); } - + public void getParameterTypes( Method method ) throws Exception { OgnlRuntime.getParameterTypes( method ); } - + public void getParameterTypes( Constructor<?> constructor ) throws Exception { OgnlRuntime.getParameterTypes( constructor ); } - + public void getPermission( Method method ) throws Exception { OgnlRuntime.getPermission( method ); } - + public void getPrimitiveDefaultValue( Class<?> type ) throws Exception { OgnlRuntime.getPrimitiveDefaultValue( type ); } - + public void invokeMethod( Object o, Method method, Object[] args ) throws Exception { OgnlRuntime.invokeMethod( o, method, args ); } - + public void clearCache( ) { OgnlRuntime.clearCache( ); } + + public void getCompiler() + { + OgnlRuntime.getCompiler(); + } } Modified: commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/RuntimeWrapper.java URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/RuntimeWrapper.java?rev=1190443&r1=1190442&r2=1190443&view=diff ============================================================================== --- commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/RuntimeWrapper.java (original) +++ commons/proper/ognl/trunk/src/benchmarks/java/org/apache/commons/ognl/performance/runtime/RuntimeWrapper.java Fri Oct 28 16:51:29 2011 @@ -51,4 +51,6 @@ public interface RuntimeWrapper { void invokeMethod(Object o, Method method, Object[] args) throws Exception; void clearCache(); + + void getCompiler(); }