Skip to content

Instantly share code, notes, and snippets.

@isicju
Created October 25, 2017 18:36
Show Gist options
  • Save isicju/23c7a4a7b2f0988888ded22e0b6f34f9 to your computer and use it in GitHub Desktop.
Save isicju/23c7a4a7b2f0988888ded22e0b6f34f9 to your computer and use it in GitHub Desktop.
making great benchmarking
package org.sample;
import org.openjdk.jmh.annotations.*;
import java.util.concurrent.TimeUnit;
public class MyBenchmark {
@Benchmark@BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS)
public void testMethod() {
doMagic();
}
public static void doMagic() {
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment