[haiku-development] Re: BList resize algorithm

  • From: "Rene Gollent" <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 9 Jun 2008 14:51:07 -0500

On Mon, Jun 9, 2008 at 12:59 PM, Rene Gollent <anevilyak@xxxxxxxxx> wrote:
> Hi,
>
> I was looking through BList's code while looking at list view
> performance, and I notice that its resizing behavior appears quite
> naive: if you hit the list capacity when adding an item, it appears to
> resize the list by 1 item only, which to me seems quite dumb. Wouldn't
> it be smarter to use a heuristic such as what std::vector does and
> double the size of the list each time? Or am I missing some trick
> here?

Never mind, I see how it uses the block size in Resize() now, the fact
that everything else was just calling Resize() with CountItems() + 1
threw me off a bit.

Regards,

Rene

Other related posts: