ARRAY | General purpose resizable ARRAYs as they are define in the Eiffel language definition.
The `lower' bound can be any arbitrary value, even a negative one.
This implementation uses only one chunk of memory, the `storage' area which is a NATIVE_ARRAY. One must
keep in mind that this internal `storage' area is always kept left align. Thus, you can expect good
performances while using an ARRAY to modelize a stack behavior with `add_last' / `last' / `remove_last'.
Conversely `add_first' and `remove_first' are likely to slow down your program if they are too often
used. If the fact that `lower' is always stuck to 0 is not a problem for you, also consider FAST_ARRAY to
get better performances.
|
FAST_ARRAY | General purpose resizable FAST_ARRAYs. The only difference with ARRAY is the fact that the `lower' bound
is actually frozen to 0. The `item' access is likely to be more efficient as well as loop going from
`upper' to `lower' just because `lower' is 0. Keep in mind that even if the `lower' is frozen to 0
it is really better to use the `lower' attribute, and not 0 directly, just because you may decide in the
futur to use another COLLECTION implementation.
Like ARRAY, the FAST_ARRAY implementation uses only one chunk of memory, the `storage' area which is a
NATIVE_ARRAY. One must keep in mind that this internal `storage' area is always kept left align. Thus,
you can expect good performances while using a FAST_ARRAY to modelize a stack behavior with `add_last' /
`last' / `remove_last'. Conversely `add_first' and `remove_first' are likely to slow down your program if
they are too often used. If the fact that `lower' is stuck to 0 do matter, also consider ARRAY.
|
LINKED_LIST | One way linked list implementation with internal automatic cached memorization of the last access.
Because of the last access memory cache, the traversal of a LINKED_LIST from the `lower' index to the
`upper' index using `item' is quite efficient. As one can expect, adding element using `add_first' or
`add_last' is really efficient too, actually, the total number of elements (i.e. `count') as well as a
reference to the last cell is also cached automatically. Keep in mind that LINKED_LIST uses a one way
linked storage from `lower' to `upper', so traversing a LINKED_LIST from `upper' to `lower' will be
extremely time consumming (also consider TWO_WAY_LINKED_LIST).
|
RING_ARRAY | The main purpose of the RING_ARRAY implementation is to allow efficient manipulation of the queue
concept (i.e. using for example `add_last' / `first' / `remove_first'). Actually, the RING_ARRAY
implementation provides very good performance for all of the following features: `add_last', `last',
`remove_last', `add_first', `first', `remove_first'.
Furthermore, the RING_ARRAY implementation also has a common point with traditional ARRAY: the `lower'
bound can be any arbitrary value, even a negative one.
As ARRAY or FAST_ARRAY, the RING_ARRAY uses only one chunk of memory, the `storage' area which is a
NATIVE_ARRAY. This internal `storage' area is used in a circular way (no left- or right-alignment),
hence the very good performances for using it as a queue. Finally, if you have to perform many insertions
in the middle of your COLLECTION, do not expect good performance with a RING_ARRAY, but consider
LINKED_LIST or TWO_WAY_LINKED_LIST.
|