liveBook · Manning

Non-object array

As explained in Fast Python: High performance techniques for large datasets

A non-object array is an array whose elements are stored as raw values of a specific data type rather than as references to general objects.

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

How Fast Python: High performance techniques for large datasets covers it

How deep it goes
Defines the representation and recommends replacement, but defers implementation details and quantitative performance evidence.
Examples
Uses replacing a list of objects with a non-object array as the concrete optimization example.
What you can do after
Apply profiling to evaluate replacing inefficient object-based collections with non-object arrays for speed.
How it connects
Connects non-object arrays with Python lists, objects, profiling, data structures, and performance optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast Python: High performance techniques for large datasets. The section links point to the parts of the book it draws on.