> 2) An attached table of attributes and ranges to which they apply?
>    Uses less memory for sparse attributes, but means that it's hard work
>    every time we have to interrogate or shuffle characters as we need to
>    check all the ranges each time to see if the characters we are
>    manipulating have metadata.

I believe this alternative has been discussed once in a while.  Which
ranges an operation affects is a log(N) operation on the character
position (binary search), and the ranges can also be kept sorted among
themselves on (primary key start position, secondary key end
position), so that finding out the victim ranges is also a log(N).
Admittedly, log(N) tends to be larger than 1, and certainly larger
than 0 :-)  Also, using UTF-8 (or any variable length encoding) is
a pain since you can't any more just happily offset to the data.

One could also implement SVs as balanced trees, splitting and merging
as the scalar grows and shrinks.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to