Index objects serve to map arbitrary keys to values:
root: makeIndex --> _h root: 12 --> _h["12"] root: _h["12"] root: 12
Values are stored in four b-trees (one each for hidden, public, system and admins properties) stored on the index object.
Thus, index objects need a minimum of two slots per key-val pair stored.
For convenience, many other Muq classes appear to store key-val pairs just as do Index objects. However, in instances of other classes do not have dedicated slots for the key-val btrees: Instead the btrees are stored in an internal Index mapping objects to btrees.
The practical result is that storing and retrieving values from Index objects will be faster, but empty Index objects will have the space overhead of the four slots used to hold the btrees.
Also note that storing just one key-val pair in an Index still requires allocating a full 512-byte btree node: Allocating large numbers of Index objects which each hold just one or two key-val pairs is not space-efficient. If space efficiency matters, you should use MOS objects, structs, vectors, or even Lists in such cases.
See section Class Hash. See section Class Set.
Go to the first, previous, next, last section, table of contents.