-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] A R-Tree search performance question #96
Comments
@bluefantasy2014 you can use the JMH framework to write such kind of micro benchmarks. |
Thanks @plokhotnyuk for chiming in. @bluefantasy2014 what you're seeing is expected. You should do some reading about Java performance and benchmarking, and Just-in-time compilation on the JVM. |
@plokhotnyuk @davidmoten Following is the result : |
Can you show us your benchmark code? |
Are you trying to benchmark the search bit only? |
@davidmoten What I am working on is a point-in-polygon (PIP) problem. For a given geo polygon(with less than 10k lines forming the border), I need to check whether a Point(longitude,latitude) located in the polygon. Want if I added the rectangles of all the lines to the tree and search against the tree? Will that boost the performance? Great thanks for your reply. |
Under the covers that's what is happening anyway so no. An R-Tree is based on rectangles. i doubt that an R-Tree is right for the point-in-polygon problem that you refer to. I'll leave the research to you! |
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)-> {});
The text was updated successfully, but these errors were encountered: