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());
        }
    }
    
    @Benchmark
    public void point(Blackhole b) {
        for (long i = 0; i < N; i++) {
            b.consume(c.point(i));
        }
    }

}
@@ -329,16 +329,114 @@
 ions(5);
+%0A    private static final SmallHilbertCurve small = HilbertCurve.small().bits(BITS).dimensions(5);
 %0A%0A    @B
@@ -639,13 +639,9 @@
   %7D%0A
-    
 %0A
+
     
@@ -719,32 +719,32 @@
 ; i %3C N; i++) %7B%0A
-
             b.co
@@ -779,9 +779,369 @@
 %0A    %7D%0A%0A
+    @Benchmark%0A    public void roundTripSmall(Blackhole b) %7B%0A        for (long i = 0; i %3C N; i++) %7B%0A            long%5B%5D point = small.point(i);%0A            b.consume(i == small.index(point));%0A        %7D%0A    %7D%0A%0A    @Benchmark%0A    public void pointSmall(Blackhole b) %7B%0A        for (long i = 0; i %3C N; i++) %7B%0A            b.consume(small.point(i));%0A        %7D%0A    %7D%0A%0A
 %7D

add small benchmarks