[haiku-development] Re: BList resize algorithm

  • From: "Rene Gollent" <anevilyak@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 9 Jun 2008 21:56:05 -0500

On Mon, Jun 9, 2008 at 1:56 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
> You actually do: the list is enlarged by fBlockSize entries, and that
> number defaults to 20. I don't know why I takes the initial count as
> the basic size to enlarge the list, but that alone shouldn't hurt.
>
> But if the list is grows large, the speed of adding items to the list
> severly suffers by this method; works fine for smaller ones, though ;-)

Ah. That could potentially be problematic...would you see any issue
with altering that so the block size is used as the starting size of
the list, and the list size is doubled on each resize instead? i.e. 20
-> 40 -> 80 -> 160, etc? That shouldn't affect apps using smaller
lists much at all, and since it's only a pointer list, wouldn't really
result in much in the way of wasted mem, while reducing the number of
reallocations drastically for large numbers of inserts. Any
objections?

Regards,

Rene

Other related posts: