package org.davidmoten.hilbert;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.infra.Blackhole;

public class Benchmarks {
    
    private static final int BITS = 10;
    private static final long N = Math.round(Math.pow(2, BITS)) - 1;
    private static final HilbertCurve c = HilbertCurve.bits(BITS).dimensions(5);
    
    @Benchmark
    public void roundTrip(Blackhole b) {
        for (long i = 0;i<N; i++) {
            long[] point = c.point(i);
            b.consume(i == c.index(point).longValue());
        }
    }

}
@@ -139,20 +139,16 @@
 marks %7B%0A
-    
 %0A    pri
@@ -330,20 +330,16 @@
 ons(5);%0A
-    
 %0A    @Be
@@ -415,10 +415,13 @@
 = 0;
-i%3C
+ i %3C 
 N; i
@@ -538,9 +538,152 @@
 %0A    %7D%0A%0A
+    @Benchmark%0A    public void point(Blackhole b) %7B%0A        for (long i = 0; i %3C N; i++) %7B%0A            b.consume(c.point(i));%0A        %7D%0A    %7D%0A%0A
 %7D

add benchmark