This question is very open and probably, the answer to this question will depend on the system, but say in average which is the best way to show a large matrix (say 128 elements) of different states?
Is there a difference in memory/CPU performance depending on choice? The number of states in my application is 4 for each cell so they need 2 bits each to represent their state. Each cell will be represented by an image related to the state.
Sure there is a difference. I will try to illustrate this and also the assumptions this is based on.
Cost of a control = memory for control + event handlers for control + references to control + one extra control in event pipeline
Benefit of "tight" control per cell mapping. Conceptually clean, simple code, easiest to think about.
Cost of tight mapping : multiply the cost per control by the number of cells.
The alternative I'm about to suggest assumes that the cost delta between tight mapping and a loose "one ring" mapping is important.
alternative : just add one control that is registered for events only within the bounds of the whole matrix view you present, has a piece of code to determine the pointer position and what cell that corresponds to, and then updates only that cell depending on the user interaction there.
The advantages of this are you get the marginal cost of only one extra control but the benefit of handling interactions for the entire matrix. The marginal benefit or this control is much higher than for a single tight control. Aldo, the implementation cost is small as it is a common pattern and not too difficult.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With