samedi 26 novembre 2016

C++ optimisation vector

I'm working on an Entity Component System, but I have some trouble with how I'll stock every components. Right now I have a manager created when a new component derived is created. And this manager manage a pool of component (by default std::vector) and another pool with the same size which contains an int32_t to manage how I access to the component, and the component ptr.

I was thinking that will be better because I can't now the size of a component, so a ptr to quick access will be better (in a small vector). But I'm young so I'm afraid that I'll made a huge mistake.

So I can't decide which one will be more interesting in a generic way:

  • 2 pools, one small for access and one big for contain raw data.
  • merge these 2 pool and have only one with my int32_t and the raw data.
  • something else.

Any advice is welcome :)

Have a great day.

Aucun commentaire:

Enregistrer un commentaire