diff --git a/index/example/benchmark_experimental.cpp b/index/example/benchmark_experimental.cpp index 709110348..2b0c2c9cb 100644 --- a/index/example/benchmark_experimental.cpp +++ b/index/example/benchmark_experimental.cpp @@ -8,8 +8,6 @@ // http://www.boost.org/LICENSE_1_0.txt) #define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL -#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS -#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS_MOVE #include @@ -176,7 +174,7 @@ int main() std::cout << time << " - query(B) " << queries_count << " found " << temp << '\n'; } -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL + { clock_t::time_point start = clock_t::now(); size_t temp = 0; @@ -211,7 +209,7 @@ int main() dur_t time = clock_t::now() - start; std::cout << time << " - qbegin(B) qend() " << queries_count << " found " << temp << '\n'; } -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS + { clock_t::time_point start = clock_t::now(); size_t temp = 0; @@ -236,64 +234,14 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - RT::const_query_iterator_alt first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); - RT::const_query_iterator_alt last = t.qend(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); + RT::const_query_iterator first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); + RT::const_query_iterator last = t.qend(); std::copy(first, last, std::back_inserter(result)); temp += result.size(); } dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased2 qbegin(B) qend(B) " << queries_count << " found " << temp << '\n'; + std::cout << time << " - type-erased qbegin(B) qend() " << queries_count << " found " << temp << '\n'; } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); - RT::const_query_iterator_alt last = t.qend(); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased2 qbegin(B) qend() " << queries_count << " found " << temp << '\n'; - } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt2 first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); - RT::const_query_iterator_alt2 last = t.qend(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased3 qbegin(B) qend(B) " << queries_count << " found " << temp << '\n'; - } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt2 first = t.qbegin(bgi::intersects(B(P(x - 10, y - 10), P(x + 10, y + 10)))); - RT::const_query_iterator_alt2 last = t.qend(); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased3 qbegin(B) qend() " << queries_count << " found " << temp << '\n'; - } -#endif -#endif { clock_t::time_point start = clock_t::now(); @@ -338,7 +286,6 @@ int main() std::cout << time << " - query(nearest(P, " << neighbours_count << ")) " << nearest_queries_count << " found " << temp << '\n'; } -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL { clock_t::time_point start = clock_t::now(); size_t temp = 0; @@ -373,7 +320,7 @@ int main() dur_t time = clock_t::now() - start; std::cout << time << " - qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n'; } -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS + { clock_t::time_point start = clock_t::now(); size_t temp = 0; @@ -398,63 +345,16 @@ int main() float x = coords[i].first; float y = coords[i].second; result.clear(); - RT::const_query_iterator_alt first = t.qbegin(bgi::nearest(P(x, y), neighbours_count)); - RT::const_query_iterator_alt last = t.qend(bgi::nearest(P(x, y), neighbours_count)); + RT::const_query_iterator first = t.qbegin(bgi::nearest(P(x, y), neighbours_count)); + RT::const_query_iterator last = t.qend(); std::copy(first, last, std::back_inserter(result)); temp += result.size(); } dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased2 qbegin(nearest(P, " << neighbours_count << ")) qend(n) " << nearest_queries_count << " found " << temp << '\n'; + std::cout << time << " - type-erased qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n'; } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < nearest_queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt first = t.qbegin(bgi::nearest(P(x, y), neighbours_count)); - RT::const_query_iterator_alt last = t.qend(); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased2 qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n'; - } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < nearest_queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt2 first = t.qbegin(bgi::nearest(P(x, y), neighbours_count)); - RT::const_query_iterator_alt2 last = t.qend(bgi::nearest(P(x, y), neighbours_count)); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased3 qbegin(nearest(P, " << neighbours_count << ")) qend(n) " << nearest_queries_count << " found " << temp << '\n'; - } - { - clock_t::time_point start = clock_t::now(); - size_t temp = 0; - for (size_t i = 0 ; i < nearest_queries_count ; ++i ) - { - float x = coords[i].first; - float y = coords[i].second; - result.clear(); - RT::const_query_iterator_alt2 first = t.qbegin(bgi::nearest(P(x, y), neighbours_count)); - RT::const_query_iterator_alt2 last = t.qend(); - std::copy(first, last, std::back_inserter(result)); - temp += result.size(); - } - dur_t time = clock_t::now() - start; - std::cout << time << " - type-erased3 qbegin(nearest(P, " << neighbours_count << ")) qend() " << nearest_queries_count << " found " << temp << '\n'; - } -#endif + +#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL { LS ls; diff --git a/index/test/rtree/test_rtree.hpp b/index/test/rtree/test_rtree.hpp index de15f6913..33af43bc1 100644 --- a/index/test/rtree/test_rtree.hpp +++ b/index/test/rtree/test_rtree.hpp @@ -18,7 +18,7 @@ // TEST //#define BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL -//#define BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS + #include #include @@ -668,13 +668,11 @@ void spatial_query(Rtree & rtree, Predicates const& pred, std::vector con exactly_the_same_outputs(rtree, output, rtree | bgi::adaptors::queried(pred)); -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL std::vector output3; std::copy(rtree.qbegin(pred), rtree.qend(pred), std::back_inserter(output3)); compare_outputs(rtree, output3, expected_output); -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS { typedef typename Rtree::const_query_iterator QI; QI first = rtree.qbegin(pred); @@ -682,9 +680,11 @@ void spatial_query(Rtree & rtree, Predicates const& pred, std::vector con std::vector output4; std::copy(first, last, std::back_inserter(output4)); compare_outputs(rtree, output4, expected_output); + QI last2 = rtree.qend(); + output4.clear(); + std::copy(first, last2, std::back_inserter(output4)); + compare_outputs(rtree, output4, expected_output); } -#endif -#endif } // rtree specific queries tests @@ -1039,13 +1039,11 @@ void nearest_query_k(Rtree const& rtree, std::vector const& input, Point exactly_the_same_outputs(rtree, output, output2); -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_EXPERIMENTAL std::vector output3; std::copy(rtree.qbegin(bgi::nearest(pt, k)), rtree.qend(bgi::nearest(pt, k)), std::back_inserter(output3)); compare_nearest_outputs(rtree, output3, expected_output, pt, greatest_distance); -#ifdef BOOST_GEOMETRY_INDEX_DETAIL_ENABLE_TYPE_ERASED_ITERATORS { typedef typename Rtree::const_query_iterator QI; QI first = rtree.qbegin(bgi::nearest(pt, k)); @@ -1053,9 +1051,11 @@ void nearest_query_k(Rtree const& rtree, std::vector const& input, Point std::vector output4; std::copy(first, last, std::back_inserter(output4)); compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance); + QI last2 = rtree.qend(); + output4.clear(); + std::copy(first, last, std::back_inserter(output4)); + compare_nearest_outputs(rtree, output4, expected_output, pt, greatest_distance); } -#endif -#endif } // rtree nearest not found