Michele Caini 8 vuotta sitten
vanhempi
commit
c1cada49d4
3 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 2 2
      README.md
  2. 1 1
      src/entt/entity/registry.hpp
  3. 1 1
      src/entt/entity/sparse_set.hpp

+ 2 - 2
README.md

@@ -189,8 +189,8 @@ Dell XPS 13 out of the mid 2014):
 
 
 | Benchmark | EntityX (compile-time) | EnTT |
 | Benchmark | EntityX (compile-time) | EnTT |
 |-----------|-------------|-------------|
 |-----------|-------------|-------------|
-| Create 1M entities | 0.0167s | **0.0076s** |
-| Destroy 1M entities | 0.0053s | **0.0031s** |
+| Create 1M entities | 0.0167s | **0.0046s** |
+| Destroy 1M entities | 0.0053s | **0.0022s** |
 | Standard view, 1M entities, one component | 0.0012s | **1.9e-07s** |
 | Standard view, 1M entities, one component | 0.0012s | **1.9e-07s** |
 | Standard view, 1M entities, two components | **0.0012s** | 0.0013s |
 | Standard view, 1M entities, two components | **0.0012s** | 0.0013s |
 | Standard view, 1M entities, two components<br/>Half of the entities have all the components | 0.0009s | **0.0007s** |
 | Standard view, 1M entities, two components<br/>Half of the entities have all the components | 0.0009s | **0.0007s** |

+ 1 - 1
src/entt/entity/registry.hpp

@@ -441,7 +441,7 @@ public:
     void destroy(entity_type entity) {
     void destroy(entity_type entity) {
         assert(valid(entity));
         assert(valid(entity));
         const auto entt = entity & traits_type::entity_mask;
         const auto entt = entity & traits_type::entity_mask;
-        const auto version = (entity & (~traits_type::entity_mask)) + (typename traits_type::entity_type{1} << traits_type::entity_shift);
+        const auto version = (((entity >> traits_type::entity_shift) + 1) & traits_type::version_mask) << traits_type::entity_shift;
         const auto node = (available ? next : ((entt + 1) & traits_type::entity_mask)) | version;
         const auto node = (available ? next : ((entt + 1) & traits_type::entity_mask)) | version;
 
 
         entities[entt] = node;
         entities[entt] = node;

+ 1 - 1
src/entt/entity/sparse_set.hpp

@@ -549,7 +549,7 @@ public:
     std::enable_if_t<!std::is_constructible<Type, Args...>::value, object_type &>
     std::enable_if_t<!std::is_constructible<Type, Args...>::value, object_type &>
     construct(entity_type entity, Args&&... args) {
     construct(entity_type entity, Args&&... args) {
         underlying_type::construct(entity);
         underlying_type::construct(entity);
-        instances.emplace_back(Type{ std::forward<Args>(args)... });
+        instances.emplace_back(Type{std::forward<Args>(args)...});
         return instances.back();
         return instances.back();
     }
     }