This commit is contained in:
Michele Caini
2018-03-04 16:03:59 +01:00
parent 7bf550a75f
commit c1cada49d4
3 changed files with 4 additions and 4 deletions

View File

@@ -189,8 +189,8 @@ Dell XPS 13 out of the mid 2014):
| 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, 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** |

View File

@@ -441,7 +441,7 @@ public:
void destroy(entity_type entity) {
assert(valid(entity));
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;
entities[entt] = node;

View File

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