package com.github.davidmoten.rtree;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;

@State(Scope.Benchmark)
public class BenchmarksRTree {

	private final RTree<Object> tree = RTreeTest.createRandomRTree(10000);

	@Benchmark
	public void createRTreeAndInsertOneEntryInto10000Entries() {
		tree.add(new Object(), RTreeTest.random());
	}

	@Benchmark
	public void searchRTreeOf10000EntriesForOneRandomEntry() {
		tree.search(RTreeTest.random()).count().toBlocking().single();
	}

}

@@ -162,16 +162,124 @@
 State;%0A%0A
+import com.github.davidmoten.rtree.geometry.Geometries;%0Aimport com.github.davidmoten.rtree.geometry.Point;%0A%0A
 @State(S
@@ -399,16 +399,68 @@
 0000);%0A%0A
+%09private final RTree%3CObject%3E tree2 = createTree();%0A%0A
 %09@Benchm
@@ -622,32 +622,36 @@
 0000
-EntriesForOneRandomEntry
+PointsUsingSmallishRectangle
 () %7B
@@ -661,16 +661,17 @@
 tree
+2
 .search(
 RTre
@@ -666,33 +666,55 @@
 .search(
-RTreeT
+Geometri
 es
-t
 .r
-andom(
+ectangle(500, 500, 510, 510
 )).count
@@ -715,16 +715,21 @@
 .count()
+%0A%09%09%09%09
 .toBlock
@@ -748,10 +748,375 @@
 ();%0A%09%7D%0A%0A
+%09private static final RTree%3CObject%3E createTree() %7B%0A%09%09RTree%3CObject%3E tree = RTree.maxChildren(10).create();%0A%09%09for (int i = 0; i %3C 10000; i++) %7B%0A%09%09%09tree = tree.add(new Object(), createPoint());%0A%09%09%7D%0A%09%09return tree;%0A%09%7D%0A%0A%09private static final Point createPoint() %7B%0A%09%09double x = Math.random() * 1000;%0A%09%09double y = Math.random() * 1000;%0A%09%09return Geometries.point(x, y);%0A%09%7D%0A%0A
 %7D%0A

fix the search benchmark