charlesconnell commented on PR #6901:
URL: https://github.com/apache/hbase/pull/6901#issuecomment-2799560542

   Yeah. To be sure, I just tried your suggestion like so:
   ```
   @State(Scope.Benchmark)
   public class ClosureBenchmark {
   
     @Param({ "10000" })
     public int loops;
   
     @Param({ "true", "false" })
     public boolean createNewClosure;
   
     @Benchmark
     public void test(Blackhole blackhole) {
       if (createNewClosure) {
         for (int i = 0; i < loops; i++) {
           blackhole.consume(
             (IntConsumer) (x -> {
                 blackhole.consume(x);
               })
           );
         }
       } else {
         IntConsumer savedClosure = x -> {
           blackhole.consume(x);
         };
         for (int i = 0; i < loops; i++) {
           blackhole.consume(savedClosure);
         }
       }
     }
   
     public static void main(String[] args) throws RunnerException, IOException 
{
       org.openjdk.jmh.Main.main(args);
     }
   }
   
   ```
   
   and the results stay the same.


-- 
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