Skip to content

[Question] A R-Tree search performance question  #96

@bluefantasy2014

Description

@bluefantasy2014

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)-> {});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions