Stable Containers to reduce tampering checks (AI12-0111)
attempts to address performance concerns about Ada containers, whilst
maintaining their safety. Each container is given a nested package named
Stable. This has similar contents to the parent
package, but provides a variant of the container type that cannot grow
or shrink, and omits operations that might tamper with elements of the
container. Such a container can be created by calling the
Copy
function, or by creating a stabilised view of a normal container. The
operations of the
Stable package do not perform
tampering checks as they are not needed, because the operations that
tamper with elements have been omitted. The tampering checks are considered
to incur the main performance overhead. The
of form of a loop
will automatically use the stable form of a container within the loop,
eliminating the need to set tampering more than once and eliminating
the need for most tampering checks within the loop.