Choosing a type for enemy hit points affects both the values they can hold and the memory they use. Smaller types can reduce storage, but they are not automatically faster; performance varies across devices. section 2.6.1 section 2.6.2
Choose a type by checking the value range and the job the data must do:
- Use int by default for runtime counters, indices, hit points, and IDs unless profiling shows another type is faster on target hardware. section 2.6.1
- For saved or networked values, compare the required range with type size. A 10,000-HP maximum fits in short or ushort; use short if values may be negative. section 2.6.2
- Test smaller types on the minimum target device when values update frequently. They may reduce memory or bandwidth while slowing runtime work. section 2.6.1 section 2.6.2
Figure 2.14 This figure shows two cache lines, one filled with ints and one with bytes, and shows that we can fit 4x more byte data than int data in a cache line.

The cache-line comparison illustrates why smaller values may increase cache density, though that alone does not guarantee faster execution. section 2.6





















