liveBook · Manning

Primitive type

As explained in High Performance Unity Game Development

A fundamental built-in data type representing basic values directly supported by a programming language.

Primitive data types represent basic values, and their choice can affect the performance of data stored in arrays. For whole numbers, integers suit hardware optimization, while byte or short use less storage but may be slower on the target device. section 2.0 section 2.7

A temporary value made of primitive types, no larger than 16 bytes, and always used together is a good candidate for a struct. Test type choices on the target device before optimizing. section 2.7

How High Performance Unity Game Development covers it

How deep it goes
Compares integer, byte, and short trade-offs and gives a struct-selection rule, while urging target-device testing.
Examples
Contrasts integers with byte or short for whole-number storage and describes small, co-used primitive fields in structs.
What you can do after
Evaluate whole-number storage choices against storage size and target-device performance.
How it connects
Connects primitive values to structs, classes, arrays, data locality, and value-copy costs.

Also explained in

Compare how 7 books explain primitive type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of High Performance Unity Game Development. The section links point to the parts of the book it draws on.