Example #1
0
 @BeforeClass
 public static void setup() {
   benchmarkParameters = new ReflectionParameters();
   benchmarkParameters.setWarmUpIteration(WARM_UP_ITERATION);
   benchmarkParameters.setBenchmarkIterationCount(BENCHMARK_ITERATION);
   benchmarkParameters.setRepeatBenchmark(REPEAT_ITERATION_TIME);
   benchmarkFactory = new BenchmarkFactory(new ReflectionBenchmark(), benchmarkParameters);
 }
Example #2
0
 @Test
 public void staticFieldTest() {
   benchmarkParameters.setReflectionBase(ReflectionParameters.ReflectionBase.ChangeField);
   benchmarkParameters.setUseReflection(false);
   benchmarkFactory.start();
   String result = benchmarkFactory.printFormattedResult();
   WriteResultUtil.writeResult(
       URL + "/field/staticField", this.getClass().getSimpleName(), result);
 }
Example #3
0
 @Test
 public void staticConstructorTest() {
   benchmarkParameters.setReflectionBase(ReflectionParameters.ReflectionBase.GetConstructor);
   benchmarkParameters.setUseReflection(false);
   benchmarkFactory.start();
   String result = benchmarkFactory.printFormattedResult();
   WriteResultUtil.writeResult(
       URL + "/constructor/staticConstructor", this.getClass().getSimpleName(), result);
 }
Example #4
0
 @Test
 public void methodCallTest() {
   benchmarkParameters.setReflectionBase(ReflectionParameters.ReflectionBase.InvokeMethod);
   benchmarkParameters.setUseReflection(false);
   benchmarkFactory.start();
   String result = benchmarkFactory.printFormattedResult();
   WriteResultUtil.writeResult(
       URL + "/methodCall/staticCall", this.getClass().getSimpleName(), result);
 }
Example #5
0
 @Test
 public void allocateArrayReflectionTest() {
   benchmarkParameters.setReflectionBase(ReflectionParameters.ReflectionBase.AllocateArray);
   benchmarkParameters.setUseReflection(true);
   benchmarkFactory.start();
   String result = benchmarkFactory.printFormattedResult();
   WriteResultUtil.writeResult(
       URL + "/array/allocateArrayReflection", this.getClass().getSimpleName(), result);
 }