|
Sparse currently has a memory efficient implementation for lists
of pointers to some objects.
These are used for 2 different purposes:
- either for a simple set of objects
- either as a sequence (ordered) of objects.
There is also another similar need:
- a map of object (aka: dictionnary, table, ...)
where the only needed operations are:
- add a new element (with it's key)
- lookup an element via it's key
- replace the element corresponding to a key
The implementation done in this patch is a very simple one
based on list of blocks of key-value pairs.
The idea being to later switch to a dynamic structure using
a hash-table as soon as the number of element reach some threshold.
However, these hash-table are only needed for some huge input files
(the current implementation is no worse than walking through
the ptrlists).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
|