|
|
Darren New wrote:
> Kevin Wampler wrote:
>> "This makes sense because modern operating systems don't copy the
>> entire data when reallocating a buffer; the physical memory pages are
>> simply reordered, and only the data on the first and last pages
>> actually needs to be copied"
>
> Well, yes, there is that. Hmmm... OK, it seems they do know what that's
> about. I guess if you don't copy the pages in the middle of the string,
> there's no need to double the size each time to get O(1) amortized growth.
In general my experience with using Qt has been extremely positive, so I
would have been surprised had they made a mistake of that magnitude.
Still, I certainly didn't anticipate that the algorithm they use would
actually be O(1), so it was quite cool to see that it was.
Post a reply to this message
|
|