@@ -136,6 +136,34 @@ namespace
136136 }
137137 }
138138
139+ static void InsertUnique (benchmark::State& state)
140+ {
141+ constexpr dim_t DIMENSION_NO = 3 ;
142+ constexpr depth_t depth = 5 ;
143+
144+ size_t entityNo = state.range ();
145+
146+ const auto points = GeneratePointsRandom<DIMENSION_NO>(entityNo);
147+ auto boxSpace = BoundingBoxND<DIMENSION_NO>{};
148+ boxSpace.Max .fill (rMax);
149+
150+ for (auto _ : state)
151+ {
152+ auto tree = TreePointND<DIMENSION_NO>();
153+ tree.Init (boxSpace, depth);
154+
155+ std::size_t entityID = 0 ;
156+ for (auto const & point : points)
157+ {
158+ if (tree.InsertUnique (entityID, point, rMax / 100.0 , points))
159+ {
160+ ++entityID;
161+ }
162+ }
163+ }
164+ }
165+
166+
139167 static void Update (benchmark::State& state)
140168 {
141169 constexpr dim_t DIMENSION_NO = 3 ;
@@ -177,6 +205,26 @@ namespace
177205 }
178206 }
179207
208+ static void FrustumCulling (benchmark::State& state)
209+ {
210+ constexpr dim_t DIMENSION_NO = 3 ;
211+ constexpr depth_t depth = 5 ;
212+
213+ size_t entityNo = state.range ();
214+
215+ const auto points = GeneratePointsRandom<DIMENSION_NO>(entityNo);
216+ const auto tree = TreePointND<DIMENSION_NO>(points, depth);
217+
218+ const auto planes = std::vector{
219+ PlaneND<DIMENSION_NO>{ .OrigoDistance = rMax * 0.9 , .Normal = { 1.0 , 0.0 , 0.0 } },
220+ PlaneND<DIMENSION_NO>{ .OrigoDistance = rMax * 0.9 , .Normal = { 0.0 , 1.0 , 0.0 } },
221+ PlaneND<DIMENSION_NO>{ .OrigoDistance = rMax * 0.9 , .Normal = { 0.0 , 0.0 , 1.0 } }
222+ };
223+ for (auto _ : state)
224+ {
225+ tree.FrustumCulling (planes, 0.1 , points);
226+ }
227+ }
180228
181229 } // namespace
182230 } // namespace Benchmarks
@@ -189,8 +237,10 @@ BENCHMARK(Benchmarks::Point::Create<false>)->Arg(10)->Arg(20)->Arg(50)->Arg(100)
189237BENCHMARK (Benchmarks::Point::Create<true >)->Arg(10 )->Arg(20 )->Arg(50 )->Arg(100 )->Arg(1000 )->Arg(10000 )->Arg(100000 )->Arg(1000000 );
190238BENCHMARK (Benchmarks::Point::InsertToLeaf)->Arg(10 )->Arg(20 )->Arg(50 )->Arg(100 )->Arg(1000 )->Arg(10000 );
191239BENCHMARK (Benchmarks::Point::InsertWithRebalancing)->Arg(10 )->Arg(20 )->Arg(50 )->Arg(100 )->Arg(1000 )->Arg(10000 );
240+ BENCHMARK (Benchmarks::Point::InsertUnique)->Arg(10 )->Arg(20 )->Arg(50 )->Arg(100 )->Arg(1000 )->Arg(10000 );
192241BENCHMARK (Benchmarks::Point::Update)->Arg(10 )->Arg(20 )->Arg(50 )->Arg(100 )->Arg(1000 )->Arg(10000 );
193- BENCHMARK (Benchmarks::Point::GetNearestNeighbors)->Arg(10000 );
242+ BENCHMARK (Benchmarks::Point::GetNearestNeighbors)->Arg(1000 )->Arg(10000 );
243+ BENCHMARK (Benchmarks::Point::FrustumCulling)->Arg(1000 )->Arg(10000 );
194244
195245// Run the benchmark
196246BENCHMARK_MAIN ();
0 commit comments