1 // Boost.Geometry Index
2 // Compare performance with std::set using 1-dimensional object
3 // (i.e. angle, or number line coordiante)
5 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
13 #include <boost/geometry.hpp>
14 #include <boost/geometry/index/rtree.hpp>
16 #include <boost/chrono.hpp>
17 #include <boost/foreach.hpp>
18 #include <boost/random.hpp>
23 namespace bg = boost::geometry;
24 namespace bgi = bg::index;
25 typedef boost::chrono::thread_clock clock_t;
26 typedef boost::chrono::duration<float> dur_t;
28 size_t values_count = 1001;
29 size_t count_start = 10;
30 size_t count_stop = 1000;
31 size_t count_step = 10;
32 size_t insrem_count = 3000000;
34 typedef bg::model::point<float, 1, bg::cs::cartesian> P;
35 //typedef bgi::rtree<P, bgi::linear<8, 3> > RT;
36 typedef bgi::rtree<P, bgi::quadratic<8, 3> > RT;
37 //typedef bgi::rtree<P, bgi::rstar<8, 3> > RT;
42 for ( size_t curr_count = count_start ; curr_count < count_stop ; curr_count += count_step )
46 for (; val_i < curr_count ; ++val_i )
48 float v = val_i / 100.0f;
54 float v = (val_i+1) / 100.0f;
57 std::cout << t.size() << ' ';
59 clock_t::time_point start = clock_t::now();
61 for (size_t i = 0 ; i < insrem_count ; ++i )
67 dur_t time = clock_t::now() - start;
68 std::cout << time.count() << ' ';
70 start = clock_t::now();
72 for (size_t i = 0 ; i < insrem_count ; ++i )
78 time = clock_t::now() - start;
79 std::cout << time.count() << ' ';