reformat StaticRTreeBench.cpp
This commit is contained in:
parent
bc6466cc36
commit
23c79f5cc9
@ -41,35 +41,40 @@ FixedPointCoordinateListPtr LoadCoordinates(const boost::filesystem::path& nodes
|
|||||||
|
|
||||||
void Benchmark(BenchStaticRTree &rtree, unsigned num_queries)
|
void Benchmark(BenchStaticRTree &rtree, unsigned num_queries)
|
||||||
{
|
{
|
||||||
std::mt19937 g(RANDOM_SEED);
|
std::mt19937 mt_rand(RANDOM_SEED);
|
||||||
std::uniform_int_distribution<> lat_udist(WORLD_MIN_LAT, WORLD_MAX_LAT);
|
std::uniform_int_distribution<> lat_udist(WORLD_MIN_LAT, WORLD_MAX_LAT);
|
||||||
std::uniform_int_distribution<> lon_udist(WORLD_MIN_LON, WORLD_MAX_LON);
|
std::uniform_int_distribution<> lon_udist(WORLD_MIN_LON, WORLD_MAX_LON);
|
||||||
std::vector<FixedPointCoordinate> queries;
|
std::vector<FixedPointCoordinate> queries;
|
||||||
for (unsigned i = 0; i < num_queries; i++)
|
for (unsigned i = 0; i < num_queries; i++)
|
||||||
{
|
{
|
||||||
queries.emplace_back(
|
queries.emplace_back(FixedPointCoordinate(lat_udist(mt_rand), lon_udist(mt_rand)));
|
||||||
FixedPointCoordinate(lat_udist(g), lon_udist(g))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned num_results = 5;
|
const unsigned num_results = 5;
|
||||||
std::cout << "#### IncrementalFindPhantomNodeForCoordinate : " << num_results << " phantom nodes" << std::endl;
|
std::cout << "#### IncrementalFindPhantomNodeForCoordinate : " << num_results
|
||||||
|
<< " phantom nodes"
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
TIMER_START(query_phantom);
|
TIMER_START(query_phantom);
|
||||||
std::vector<PhantomNode> resulting_phantom_node_vector;
|
std::vector<PhantomNode> resulting_phantom_node_vector;
|
||||||
for (const auto &q : queries)
|
for (const auto &q : queries)
|
||||||
{
|
{
|
||||||
resulting_phantom_node_vector.clear();
|
resulting_phantom_node_vector.clear();
|
||||||
rtree.IncrementalFindPhantomNodeForCoordinate(q, resulting_phantom_node_vector, 3, num_results);
|
rtree.IncrementalFindPhantomNodeForCoordinate(
|
||||||
|
q, resulting_phantom_node_vector, 3, num_results);
|
||||||
resulting_phantom_node_vector.clear();
|
resulting_phantom_node_vector.clear();
|
||||||
rtree.IncrementalFindPhantomNodeForCoordinate(q, resulting_phantom_node_vector, 17, num_results);
|
rtree.IncrementalFindPhantomNodeForCoordinate(
|
||||||
|
q, resulting_phantom_node_vector, 17, num_results);
|
||||||
}
|
}
|
||||||
TIMER_STOP(query_phantom);
|
TIMER_STOP(query_phantom);
|
||||||
|
|
||||||
std::cout << "Took " << TIMER_MSEC(query_phantom) << " msec for " << num_queries << " queries." << std::endl;
|
std::cout << "Took " << TIMER_MSEC(query_phantom) << " msec for " << num_queries << " queries."
|
||||||
std::cout << TIMER_MSEC(query_phantom)/((double) num_queries) << " msec/query." << std::endl;
|
<< "\n";
|
||||||
|
std::cout << TIMER_MSEC(query_phantom) / ((double)num_queries) << " msec/query."
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
std::cout << "#### LocateClosestEndPointForCoordinate" << std::endl;
|
std::cout << "#### LocateClosestEndPointForCoordinate"
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
TIMER_START(query_endpoint);
|
TIMER_START(query_endpoint);
|
||||||
FixedPointCoordinate result;
|
FixedPointCoordinate result;
|
||||||
@ -79,10 +84,13 @@ void Benchmark(BenchStaticRTree& rtree, unsigned num_queries)
|
|||||||
}
|
}
|
||||||
TIMER_STOP(query_endpoint);
|
TIMER_STOP(query_endpoint);
|
||||||
|
|
||||||
std::cout << "Took " << TIMER_MSEC(query_endpoint) << " msec for " << num_queries << " queries." << std::endl;
|
std::cout << "Took " << TIMER_MSEC(query_endpoint) << " msec for " << num_queries << " queries."
|
||||||
std::cout << TIMER_MSEC(query_endpoint)/((double) num_queries) << " msec/query." << std::endl;
|
<< "\n";
|
||||||
|
std::cout << TIMER_MSEC(query_endpoint) / ((double)num_queries) << " msec/query."
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
std::cout << "#### FindPhantomNodeForCoordinate" << std::endl;
|
std::cout << "#### FindPhantomNodeForCoordinate"
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
TIMER_START(query_phantomnode);
|
TIMER_START(query_phantomnode);
|
||||||
for (const auto &q : queries)
|
for (const auto &q : queries)
|
||||||
@ -92,15 +100,19 @@ void Benchmark(BenchStaticRTree& rtree, unsigned num_queries)
|
|||||||
}
|
}
|
||||||
TIMER_STOP(query_phantomnode);
|
TIMER_STOP(query_phantomnode);
|
||||||
|
|
||||||
std::cout << "Took " << TIMER_MSEC(query_phantomnode) << " msec for " << num_queries << " queries." << std::endl;
|
std::cout << "Took " << TIMER_MSEC(query_phantomnode) << " msec for " << num_queries
|
||||||
std::cout << TIMER_MSEC(query_phantomnode)/((double) num_queries) << " msec/query." << std::endl;
|
<< " queries."
|
||||||
|
<< "\n";
|
||||||
|
std::cout << TIMER_MSEC(query_phantomnode) / ((double)num_queries) << " msec/query."
|
||||||
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
std::cout << "./rtree-bench file.ramIndex file.fileIndx file.nodes" << std::endl;
|
std::cout << "./rtree-bench file.ramIndex file.fileIndx file.nodes"
|
||||||
|
<< "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user