# Component arrays vs. entity structs? [closed]

Two of the main systems I've seen in entity system tutorials are:

• An Entities class with one array / [hash]map for each component, with indices corresponding to entity IDs.
• A list of Entity structs, which have the components as fields, and possibly a pointer to a "cold" struct for less used components.

What are the reasons I would use the former over the latter, considering that the latter seems much easier to implement? Is there some advantage to having each attribute laid out contiguously in memory?

## closed as too broad by Lars Viklund, Alexandre Vaillancourt♦, Josh♦Jan 19 '16 at 16:41

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.