Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openjdk.jmh.annotations.*;
- import org.openjdk.jmh.runner.options.Options;
- import org.openjdk.jmh.runner.options.OptionsBuilder;
- import java.util.concurrent.TimeUnit;
- @State(Scope.Benchmark)
- public class Main {
- @Benchmark
- @BenchmarkMode(Mode.SampleTime)
- @Fork(warmups = 0, value = 1)
- @Measurement(iterations = 10)
- @OutputTimeUnit(TimeUnit.MICROSECONDS)
- public void MergeSort(){
- var ms = new MergeSort();
- ms.ArraySort();
- }
- @Benchmark
- @BenchmarkMode(Mode.SampleTime)
- @Fork(warmups = 0, value = 1)
- @Measurement(iterations = 10)
- @OutputTimeUnit(TimeUnit.MICROSECONDS)
- public void QuickSort(){
- var qs = new QuickSort();
- qs.ArraySort();
- }
- @Benchmark
- @BenchmarkMode(Mode.SampleTime)
- @Fork(warmups = 0, value = 1)
- @Measurement(iterations = 10)
- @OutputTimeUnit(TimeUnit.MICROSECONDS)
- public void BubbleSort(){
- var bs = new BubbleSort();
- bs.ArraySort();
- }
- public static void main(String[] args) throws RuntimeException{
- Options opt = new OptionsBuilder()
- .include(Main.class.getSimpleName())
- .forks(1)
- .build();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement