Explorar o código

updated benchmark

Michele Caini %!s(int64=7) %!d(string=hai) anos
pai
achega
ffd5defcb6
Modificáronse 2 ficheiros con 10 adicións e 10 borrados
  1. 1 1
      TODO
  2. 9 9
      test/benchmark/benchmark.cpp

+ 1 - 1
TODO

@@ -20,4 +20,4 @@
   - each components only return actual component, so shared components are returned only once
 * add a sort of "fast each" for when users know they are not to add/remove components, it can use directly raw access and improve even further performance
 * types defined at runtime that refer to the same compile-time type (but to different pools) are possible, the library is almost there
-* view/group iterators that return entities and components? I'd still like to have it :-)
+* add take functionality, eg registry.take(entity, other); where it takes the entity and all its components from registry and move them to other

+ 9 - 9
test/benchmark/benchmark.cpp

@@ -43,11 +43,11 @@ void pathological(Func func) {
     }
 
     for(auto i = 0; i < 10; ++i) {
-        registry.each([i = 0, &registry](const auto entity) mutable {
-            if(i % 7) { registry.remove<position>(entity); }
-            if(i % 11) { registry.remove<velocity>(entity); }
-            if(i % 13) { registry.remove<comp<0>>(entity); }
-            if(i % 17) { registry.destroy(entity); }
+        registry.each([i, &registry](const auto entity) mutable {
+            if(!(i % 7)) { registry.remove<position>(entity); }
+            if(!(i % 11)) { registry.remove<velocity>(entity); }
+            if(!(i % 13)) { registry.remove<comp<0>>(entity); }
+            if(!(i % 17)) { registry.destroy(entity); }
         });
 
         for(std::uint64_t j = 0; j < 50000L; j++) {
@@ -161,10 +161,10 @@ TEST(Benchmark, IterateSingleComponentRuntime1M) {
 
     std::cout << "Iterating over 1000000 entities, one component, runtime view" << std::endl;
 
-     for(std::uint64_t i = 0; i < 1000000L; i++) {
-         const auto entity = registry.create();
-         registry.assign<position>(entity);
-     }
+    for(std::uint64_t i = 0; i < 1000000L; i++) {
+        const auto entity = registry.create();
+        registry.assign<position>(entity);
+    }
 
     auto test = [&registry](auto func) {
         using component_type = typename entt::registry::component_type;