-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Hi Dave,
I have a performance related question.
I created a R-Tree and added 3000 Line objects to it . Then I create a new Line object and call the R-Tree's search() funciton to search all the lines that intersect with the input line.
My question is the first search() call cost about 50ms. After the search() is called multiple times. I call the search() again , it only cost 1~5ms. I want to know why?
Does R-Tree need some warm up process? Or maybe the JIT matters?
I am looking forward for your reply.
Thanks,
Jerry Shi
The following is my pseudo code:
RTree<String, Line> tree = RTree.maxChildren(5).create();
for (int i = 0; i<1000; ++i){
tree = tree.add(i+"", createRandomLine(100,500));
}
Line line = Geometries.line(10.5, 10.5, 100, 200);
//the first call cost about 50ms;
tree.search(line).subscribe((t)-> {});
for (int i = 0; i<10000; ++i){
Line line = Geometries.line(1.0,1.0,i,i);
tree.search(line).subscribe((t)-> {});
}
//the same call cost about 1~5ms;
tree.search(line).subscribe((t)-> {});