Pointer array: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Marshall
(Created page with "In nested array theory, a pointer array is an array which is mixed or nested. It corresponds to an array of boxes in flat array...")
 
Miraheze>Marshall
mNo edit summary
Line 1: Line 1:
In [[nested array theory]], a pointer array is an array which is [[Mixed array|mixed]] or [[Nested array|nested]]. It corresponds to an array of [[Box|boxes]] in [[flat array theory]]: pointer arrays are exactly those which require boxes to store in a flat APL. Every array is either a [[Simple array|simple]] [[character]], simple [[numeric]], or pointer array (adding a new class of [[simple scalar]] would add a new possibility).
In [[nested array theory]], a '''pointer array''' is an array which is [[Mixed array|mixed]] or [[Nested array|nested]]. It corresponds to an array of [[Box|boxes]] in [[flat array theory]]: pointer arrays are exactly those which require boxes to store in a flat APL. Every array is either a [[Simple array|simple]] [[character]], simple [[numeric]], or pointer array (adding a new class of [[simple scalar]] would add a new possibility).


Pointer arrays take more space to store than flat arrays and are often slower to manipulate. The size of each pointer is the processor's [https://en.wikipedia.org/wiki/Word_(computer_architecture) machine word] size—64 bits on a 64-bit machine. However, each element of a pointer array is itself an array, and is stored with an array header which may be several times the size of a pointer. When a simple array is converted to a pointer array, for instance, by appending a non-simple array as an element, the space used may be tens or even hundreds of times larger than it was before. If the type of the original array elements was smaller (in bits) than a pointer, [[structural functions]] on the array will be slower. Even if the original type was large, functions that need to read elements of the array, such as [[scalar functions]], will be many times slower because of the need to follow a pointer to read every element.
Pointer arrays take more space to store than flat arrays and are often slower to manipulate. The size of each pointer is the processor's [[wikipedia:Word_(computer_architecture)|machine word]] size—64 bits on a 64-bit machine. However, each element of a pointer array is itself an array, and is stored with an array header which may be several times the size of a pointer. When a simple array is converted to a pointer array, for instance, by appending a non-simple array as an element, the space used may be tens or even hundreds of times larger than it was before. If the type of the original array elements was smaller (in bits) than a pointer, [[structural function]]s on the array will be slower. Even if the original type was large, functions that need to read elements of the array, such as [[scalar function]]s, will be many times slower because of the need to follow a pointer to read every element.

Revision as of 14:25, 14 November 2019

In nested array theory, a pointer array is an array which is mixed or nested. It corresponds to an array of boxes in flat array theory: pointer arrays are exactly those which require boxes to store in a flat APL. Every array is either a simple character, simple numeric, or pointer array (adding a new class of simple scalar would add a new possibility).

Pointer arrays take more space to store than flat arrays and are often slower to manipulate. The size of each pointer is the processor's machine word size—64 bits on a 64-bit machine. However, each element of a pointer array is itself an array, and is stored with an array header which may be several times the size of a pointer. When a simple array is converted to a pointer array, for instance, by appending a non-simple array as an element, the space used may be tens or even hundreds of times larger than it was before. If the type of the original array elements was smaller (in bits) than a pointer, structural functions on the array will be slower. Even if the original type was large, functions that need to read elements of the array, such as scalar functions, will be many times slower because of the need to follow a pointer to read every element.