ayebear / es

An easy to use, high performance, C++14 "Entity Component System" library.
MIT License
11 stars 2 forks source link

Improve Performance (Component types with type_index) #1

Open ayebear opened 9 years ago

ayebear commented 9 years ago

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: