Remove the use of type_index with unordered_map for components. Even though unordered_map has an amortized constant lookup/insertion time, it's still a few orders of magnitude slower than a raw vector.
Since components won't need to be un-registered, implement a "family ID" setup for Component types that starts at 0. Then, use a vector where the index is the ID, in these situations:
In the ComponentPool, to store multiple ComponentArray instances
In EntityData (inside of Core) to store the component set for each Entity
The component set should be resized to the total number of component types, so adding new components won't trigger reallocations.
While the component sets are going to be initially larger, they will still be relatively small. It's worth it for the performance improvement and consistency. Even unordered_map takes up extra memory than the number of elements inside it anyway.
Remove the use of type_index with unordered_map for components. Even though unordered_map has an amortized constant lookup/insertion time, it's still a few orders of magnitude slower than a raw vector.
Since components won't need to be un-registered, implement a "family ID" setup for Component types that starts at 0. Then, use a vector where the index is the ID, in these situations: