import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Random;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.net.InetAddresses;
import com.maxmind.db.InvalidDatabaseException;
import com.maxmind.db.Reader;
import com.maxmind.db.Reader.FileMode;

public class Benchmark {

    public static void main(String[] args) throws IOException,
            InvalidDatabaseException {
        File file = new File("GeoLite2-City.mmdb");

        Reader r = new Reader(file, FileMode.MEMORY_MAPPED);
        Random random = new Random();
        int count = 1000000;
        long startTime = System.nanoTime();
        for (int i = 0; i < count; i++) {
            InetAddress ip = InetAddresses.fromInteger(random.nextInt());
            if (i % 50000 == 0) {
                System.out.println(i + " " + ip);
            }
            JsonNode t = r.get(ip);
        }
        long endTime = System.nanoTime();

        long duration = endTime - startTime;
        System.out.println("Requests per second: " + count * 1000000000.0
                / (duration));
    }
}

@@ -333,16 +333,198 @@
 mark %7B%0A%0A
+    private final static int COUNT = 1000000;%0A    private final static int WARMUPS = 3;%0A    private final static int BENCHMARKS = 5;%0A    private final static boolean TRACE = false;%0A%0A
     publ
@@ -577,28 +577,16 @@
 ception,
-%0A           
  Invalid
@@ -638,32 +638,320 @@
 ile(
-%22GeoLite2-City.mmdb%22);%0A%0A
+args.length %3E 0 ? args%5B0%5D : %22GeoLite2-City.mmdb%22);%0A        loop(%22Warming up%22, file, WARMUPS);%0A        loop(%22Benchmarking%22, file, BENCHMARKS);%0A    %7D%0A%0A    private static void loop(String msg, File file, int loops) throws IOException %7B%0A        System.out.println(msg);%0A        for (int i = 0; i %3C loops; i++) %7B%0A    
     
@@ -1019,42 +1019,76 @@
     
-Random random = new Random
+    bench(r, COUNT, i);%0A        %7D%0A        System.out.println
 ();%0A    
     
@@ -1087,31 +1087,133 @@
     
+%7D%0A%0A
     
-int count = 1000000
+private static void bench(Reader r, int count, int seed) throws IOException %7B%0A        Random random = new Random(seed)
 ;%0A  
@@ -1366,24 +1366,89 @@
 nextInt());%0A
+            JsonNode t = r.get(ip);%0A            if (TRACE) %7B%0A    
             
@@ -1465,24 +1465,28 @@
 000 == 0) %7B%0A
+    
             
@@ -1539,45 +1539,70 @@
     
-%7D%0A            JsonNode t = r.get(ip);
+        System.out.println(t);%0A                %7D%0A            %7D
 %0A   
@@ -1708,102 +1708,107 @@
     
-System.out.println(%22Requests per second: %22 + count * 1000000000.0%0A                / (duration)
+long qps = count * 1000000000L / duration;%0A        System.out.println(%22Requests per second: %22 + qps
 );%0A 

improve benchmark code