On Thu, 25 Mar 1999, Alejandro Aguilar Sierra wrote:
> On Thu, 25 Mar 1999, Asger Alstrup Nielsen wrote:
>
> > Let me repeat that the most important reason *is* speed related:
>
> Then it's not a good reason since we have no problems with speed, but we
> could have with memory.
If we're really going to worry about memory then we could always implement
a fancy string class that keeps individual words in a string table.
Similar to what an SGI rope is, only I'm thinking of a more efficient
lookup scheme for matching words in the table (hash functions) and
allowing editting this way also, rather than the two substring scheme
that SGI describes. The result for "Here is a sentence." would look
something like:
1 Here
2 is
3 a
4 sentence
5 ' '
6 '.'
1, 5, 2, 5, 3, 5, 4, 6
A big document would have a lot of repeated words and hence a lot of saved
memory. Anyway, it might be a nice little research project for somebody
but I don't expect anyone to accept it for a replacement for LString or
vector<char>. The trouble is we'd have a slower c_str() operator O(n) and
it'd be slower than vector for that task and Asger has already argued
against vector.
Allan. (ARRae)