|
@@ -37,7 +37,7 @@ TEST(DefaultRegistry, Construct) {
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create();
|
|
registry.create();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -50,13 +50,13 @@ TEST(DefaultRegistry, Destroy) {
|
|
|
|
|
|
|
|
std::cout << "Destroying 10000000 entities" << std::endl;
|
|
std::cout << "Destroying 10000000 entities" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
entities.push_back(registry.create());
|
|
entities.push_back(registry.create());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
|
|
|
|
|
- for (auto entity: entities) {
|
|
|
|
|
|
|
+ for(auto entity: entities) {
|
|
|
registry.destroy(entity);
|
|
registry.destroy(entity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -92,19 +92,12 @@ TEST(DefaultRegistry, IterateSingleComponent10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, one component" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, one component" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position>();
|
|
registry.create<Position>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position>().each([](auto, auto &) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -113,21 +106,12 @@ TEST(DefaultRegistry, IterateTwoComponents10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity>();
|
|
registry.create<Position, Velocity>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -136,22 +120,13 @@ TEST(DefaultRegistry, IterateTwoComponents10MHalf) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components, half of the entities have all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components, half of the entities have all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity>();
|
|
auto entity = registry.create<Velocity>();
|
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -160,22 +135,13 @@ TEST(DefaultRegistry, IterateTwoComponents10MOne) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components, only one entity has all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components, only one entity has all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity>();
|
|
auto entity = registry.create<Velocity>();
|
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -185,21 +151,12 @@ TEST(DefaultRegistry, IterateTwoComponentsPersistent10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity>();
|
|
registry.create<Position, Velocity>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -209,22 +166,13 @@ TEST(DefaultRegistry, IterateTwoComponentsPersistent10MHalf) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view, half of the entities have all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view, half of the entities have all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity>();
|
|
auto entity = registry.create<Velocity>();
|
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -234,22 +182,13 @@ TEST(DefaultRegistry, IterateTwoComponentsPersistent10MOne) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view, only one entity has all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, two components, persistent view, only one entity has all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity>();
|
|
auto entity = registry.create<Velocity>();
|
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -258,27 +197,12 @@ TEST(DefaultRegistry, IterateFiveComponents10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, five components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, five components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -287,37 +211,12 @@ TEST(DefaultRegistry, IterateTenComponents10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -326,38 +225,13 @@ TEST(DefaultRegistry, IterateTenComponents10MHalf) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components, half of the entities have all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components, half of the entities have all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -366,38 +240,13 @@ TEST(DefaultRegistry, IterateTenComponents10MOne) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components, only one entity has all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components, only one entity has all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -407,27 +256,12 @@ TEST(DefaultRegistry, IterateFiveComponentsPersistent10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, five components, persistent view" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, five components, persistent view" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -437,37 +271,12 @@ TEST(DefaultRegistry, IterateTenComponentsPersistent10M) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
registry.create<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -477,38 +286,13 @@ TEST(DefaultRegistry, IterateTenComponentsPersistent10MHalf) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view, half of the entities have all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view, half of the entities have all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
if(i % 2) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -518,38 +302,13 @@ TEST(DefaultRegistry, IterateTenComponentsPersistent10MOne) {
|
|
|
|
|
|
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view, only one entity has all the components" << std::endl;
|
|
std::cout << "Iterating over 10000000 entities, ten components, persistent view, only one entity has all the components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 10000000L; i++) {
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 10000000L; i++) {
|
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
auto entity = registry.create<Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
if(i == 5000000L) { registry.assign<Position>(entity); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
-
|
|
|
|
|
- auto view = registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>();
|
|
|
|
|
-
|
|
|
|
|
- for(auto entity: view) {
|
|
|
|
|
- auto &position = view.get<Position>(entity);
|
|
|
|
|
- auto &velocity = view.get<Velocity>(entity);
|
|
|
|
|
- auto &comp1 = view.get<Comp<1>>(entity);
|
|
|
|
|
- auto &comp2 = view.get<Comp<2>>(entity);
|
|
|
|
|
- auto &comp3 = view.get<Comp<3>>(entity);
|
|
|
|
|
- auto &comp4 = view.get<Comp<4>>(entity);
|
|
|
|
|
- auto &comp5 = view.get<Comp<5>>(entity);
|
|
|
|
|
- auto &comp6 = view.get<Comp<6>>(entity);
|
|
|
|
|
- auto &comp7 = view.get<Comp<7>>(entity);
|
|
|
|
|
- auto &comp8 = view.get<Comp<8>>(entity);
|
|
|
|
|
- (void)position;
|
|
|
|
|
- (void)velocity;
|
|
|
|
|
- (void)comp1;
|
|
|
|
|
- (void)comp2;
|
|
|
|
|
- (void)comp3;
|
|
|
|
|
- (void)comp4;
|
|
|
|
|
- (void)comp5;
|
|
|
|
|
- (void)comp6;
|
|
|
|
|
- (void)comp7;
|
|
|
|
|
- (void)comp8;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
|
|
|
timer.elapsed();
|
|
timer.elapsed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -559,15 +318,14 @@ TEST(DefaultRegistry, SortSingle) {
|
|
|
|
|
|
|
|
std::cout << "Sort 150000 entities, one component" << std::endl;
|
|
std::cout << "Sort 150000 entities, one component" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 150000L; i++) {
|
|
|
|
|
- auto entity = registry.create();
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 150000L; i++) {
|
|
|
|
|
+ auto entity = registry.create<Position>({ i, i });
|
|
|
entities.push_back(entity);
|
|
entities.push_back(entity);
|
|
|
- registry.assign<Position>(entity, i, i);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Timer timer;
|
|
Timer timer;
|
|
|
|
|
|
|
|
- registry.sort<Position>([®istry](const auto &lhs, const auto &rhs) {
|
|
|
|
|
|
|
+ registry.sort<Position>([](const auto &lhs, const auto &rhs) {
|
|
|
return lhs.x < rhs.x && lhs.y < rhs.y;
|
|
return lhs.x < rhs.x && lhs.y < rhs.y;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -580,14 +338,12 @@ TEST(DefaultRegistry, SortMulti) {
|
|
|
|
|
|
|
|
std::cout << "Sort 150000 entities, two components" << std::endl;
|
|
std::cout << "Sort 150000 entities, two components" << std::endl;
|
|
|
|
|
|
|
|
- for (uint64_t i = 0; i < 150000L; i++) {
|
|
|
|
|
- auto entity = registry.create();
|
|
|
|
|
|
|
+ for(uint64_t i = 0; i < 150000L; i++) {
|
|
|
|
|
+ auto entity = registry.create<Position, Velocity>({ i, i }, { i, i });
|
|
|
entities.push_back(entity);
|
|
entities.push_back(entity);
|
|
|
- registry.assign<Position>(entity, i, i);
|
|
|
|
|
- registry.assign<Velocity>(entity, i, i);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- registry.sort<Position>([®istry](const auto &lhs, const auto &rhs) {
|
|
|
|
|
|
|
+ registry.sort<Position>([](const auto &lhs, const auto &rhs) {
|
|
|
return lhs.x < rhs.x && lhs.y < rhs.y;
|
|
return lhs.x < rhs.x && lhs.y < rhs.y;
|
|
|
});
|
|
});
|
|
|
|
|
|