jdeppe-pivotal commented on PR #7548:
URL: https://github.com/apache/geode/pull/7548#issuecomment-1087564124

   @pivotal-jbarrett Here is the JMH setup I ran:
   ```
   public class PerformanceSample {
   
     @State(Scope.Thread)
     public static class BenchmarkState {
       List<Integer> list;
   
       @Setup(Level.Trial)
       public void initialize() {
         Random rand = new Random();
   
         list = new ArrayList<>();
         for (int i = 0; i < 1000; i++) {
           list.add(rand.nextInt());
         }
       }
     }
   
     @Benchmark
     public void benchmark1_original(BenchmarkState state, Blackhole bh) {
       List<Integer> list = state.list;
   
       for (long i = 0; i < 1_000_000; i++) {
         bh.consume(JvmSizeUtils.roundUpSize_original(i));
       }
     }
   
     @Benchmark
     public void benchmark2_improved(BenchmarkState state, Blackhole bh) {
       List<Integer> list = state.list;
   
       for (long i = 0; i < 1_000_000; i++) {
         bh.consume(JvmSizeUtils.roundUpSize(i));
       }
     }
   
     @Test
     public void launchBenchmark() throws Exception {
       Options opt = new OptionsBuilder()
           // Specify which benchmarks to run.
           // You can be more specific if you'd like to run only one benchmark 
per test.
           .include(this.getClass().getName() + ".*")
           // Set the following options as needed
           .mode(Mode.AverageTime)
           .timeUnit(TimeUnit.MICROSECONDS)
           .warmupTime(TimeValue.seconds(1))
           .warmupIterations(2)
           .measurementTime(TimeValue.seconds(4))
           .measurementIterations(5)
           .threads(2)
           .forks(1)
           .shouldFailOnError(true)
           .shouldDoGC(true)
           // .jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining")
           // .addProfiler(SafepointsProfiler.class)
           // .addProfiler(GCProfiler.class)
           // .addProfiler(HotspotRuntimeProfiler.class)
           // .addProfiler(HotspotMemoryProfiler.class)
           // .addProfiler(StackProfiler.class)
           .build();
   
       new Runner(opt).run();
     }
   }
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to