removed spaces: not satisfied with the current implementation
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <chrono>
|
||||
#include <gtest/gtest.h>
|
||||
#include <entt/entity/registry.hpp>
|
||||
#include <entt/entity/space.hpp>
|
||||
|
||||
struct Position {
|
||||
std::uint64_t x;
|
||||
@@ -315,152 +314,3 @@ TEST(Benchmark, SortMulti) {
|
||||
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceConstruct) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Constructing 1000000 entities" << std::endl;
|
||||
|
||||
Timer timer;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
space.create();
|
||||
}
|
||||
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceAssign) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Assigning 1000000 entities" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
registry.create<int>();
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
|
||||
for(auto entity: registry.view<int>()) {
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateSingleComponent1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, one component" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.view<Position>([](auto, auto &) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateTwoComponents1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, two components" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.view<Position, Velocity>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateTwoComponentsPersistent1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
registry.prepare<Position, Velocity>();
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, two components, persistent view" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.persistent<Position, Velocity>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateFiveComponents1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, five components" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateFiveComponentsPersistent1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, five components, persistent view" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateTenComponents1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, ten components" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
TEST(Benchmark, SpaceIterateTenComponentsPersistent1M) {
|
||||
entt::DefaultRegistry registry;
|
||||
entt::DefaultSpace space{registry};
|
||||
registry.prepare<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
||||
|
||||
std::cout << "Iterating over 1000000 entities, ten components, persistent view" << std::endl;
|
||||
|
||||
for(std::uint64_t i = 0; i < 1000000L; i++) {
|
||||
const auto entity = registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
||||
space.assign(entity);
|
||||
}
|
||||
|
||||
Timer timer;
|
||||
space.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>([](auto, auto &...) {});
|
||||
timer.elapsed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user