For example from:
Code: Select all
volatile_electrical_info {...some bytes that change often...};
struct entity {
volatile_electrical_info e_data;
volatile_electrical_info& get_e_data() {return e_data;}
...
};
Code: Select all
volatile_electrical_info {...some bytes that change often...};
std::vector<volatile_electrical_info> array_of_electrical_info;
struct entity {
int e_data_index;
volatile_electrical_info& get_e_data() {return array_of_electrical_info[e_data_index];}
...
};
Another improvement would be to separate the arrays into chunks.
I don't think this method is a good idea for early..mid development because it introduces indirection and centralizes data storage which makes changes more complicated. More performance is nice but it's not a deciding factor right now (my opinion). If you want to have the resources to continue development you could do something like this after 1.0 is released.