Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define INTERSECTIONS 100U
- static void InternalIterator(benchmark::State& state)
- {
- cs::ComponentManager manager;
- // Generate intersections
- for (std::uint32_t iteration = 0U; iteration < INTERSECTIONS; iteration++)
- {
- manager.save(iteration, static_cast<int>(iteration));
- manager.save(iteration, static_cast<float>(iteration));
- }
- for (auto _ : state) {
- manager.each<int, float>([](auto id, auto& i, auto& f) { /* blank */ });
- }
- }
- static void ExternalIterator(benchmark::State& state)
- {
- cs::ComponentManager manager;
- // Generate intersections
- for (std::uint32_t iteration = 0U; iteration < INTERSECTIONS; iteration++)
- {
- manager.save(iteration, static_cast<int>(iteration));
- manager.save(iteration, static_cast<float>(iteration));
- }
- for (auto _ : state) {
- manager.eachWithIterator<int, float>([](auto id, auto& i, auto& f) { /* blank */ });
- }
- }
- BENCHMARK(InternalIterator);
- BENCHMARK(ExternalIterator);
- BENCHMARK_MAIN();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement