[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octet vs Char (Re: strings draft)



On Tuesday 27 January 2004 09:32 am, bear wrote:
> On Mon, 26 Jan 2004, Ken Dickey wrote:
> >Well color me dumb, but I don't see why getting O(1) is such a big deal.
...
> O(1) reference or character setting comes at the expense of O(n)
> insertions, deletions, and non-identical-sized replacements.
>
> EG, if I change "the" to "a" at the beginning of a long string, and
> I've represented it as a vector to get O(1) reference time, the rest of
> the string has to be copied to move it two character spaces in memory.
>
> This is no big deal, on the same order as a function call overhead, for
> strings of 250 characters or less.  But it starts to be a very big deal
> when the string is the size of a large novel, around  2 million
> characters.

Ah,  Yes I have seen the Cedar Mesa "ropes" code.

I was puzzled by the ropes discussion here because it seemed to be orthogonal 
to the  Unicode discussion.  I now see that its because it _is_ orthogonal to 
the Unicode discussion.

Thanks for clearing this up for me,
-KenD