A non-object array stores elements as raw values of one specific data type rather than references to general objects. In performance-oriented Python data processing, it can replace a list of objects when profiling identifies speed as a concern. section 1.4
Use the structure as part of a measured optimization workflow:
- Inspect native Python data structures and profile the algorithm to locate performance problems. section 1.4
- Evaluate a non-object array instead of a list of objects when the data and access pattern permit it. section 1.4
- Compare the optimized implementation rather than treating the replacement as universally beneficial. section 1.4
Speed-sensitive collection
For a native Python routine using a list of objects, profile the routine and test whether a non-object array preserves the required values while improving speed. section 1.4
