Ukendio/jecs

Sparse Components (non-movable components)

Opened this issue · 0 comments

Non-movable components, that when inserted goes into the sparse set storage. The sparse component itself does not need to be moved to the destination archetype during insertion.

Benefits

  • Doesn't need to move the sparse component itself so slightly faster removals and insertions
  • Fast iteration of single sparse components since it should just iterate over the densely packed pool/column

Drawbacks

  • Explicit storage specification
  • Queries of sparse components are always slower than archetype queries except for two scenarios:
  1. if the query is just interested in a single sparse component (just iterate the dense array of the sparse set)
  2. if fragmentation is very high (like 1-2 entities per archetype, and lots of archetypes)