PackageDescription: SYSEXT-RawArray


SYSEXT - Raw Array

Last published: July 8, 2021 by 'nice'

Defines 14 Classes
Extends 14 Classes


System Extension :

Add classes well suited to handle efficiently large arrays of limited precision real numbers.
(avoiding a memory allocation for each element).

This also handles collections of complex numbers.
The message i: must be understood by numbers to create a complex number via
realPart i: imaginaryPart
or more concisely :
a i: b
it is less nice but more efficient than creating a complex through well admitted interface :
a + b i
And for those dealing with large arrays and computer algebra, efficiency does matter.

This also handles collections of fixed size integers, signed or unsigned (int8 int16 int32 int64 uint8 uint16 uint32 uint64).
This uses less space than Array of SmallInteger for 8 and 16 bits, and avoid LargeInteger for 32 and 64 bits.
Note that some unsigned flavours (uint8, uint16 and uint32) have already equivalent and more optimized base Smalltalk classes (ByteArray, WordArray, DWrodArray).
However the RawArray flavours have mechanisms for collecting into a RawArray class (mutated in order to hold eventually larger elements).

Historical notes:
Using this kind of array was first necessary against a ParcPlace Smalltalk-80 version 2.3 bug:
The ProcessorScheduler did preempt only at regular interval.
If a loop allocating objetcs were run on a machine fast enough,
then lowSpace handler would eventually not have a chance to run before memory is completely exhausted...
for example (1 to: 1000000) asArray collect: [:each | each asDouble] could result in a system exit...
At that time, working on Large Matrices, plotting Graphics with many points, among other things, was dangerous !