[haiku-development] Re: BList resize algorithm

"Rene Gollent" <anevilyak@xxxxxxxxx> wrote:
> > 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?

Not at all. BTW while you're at it, you might want to have a look at 
#2363 :-)
A division error should only happen if fBlockSize == -1, though, and I 
don't really see how this could happen unless Civilization overwrites 
some memory.

Bye,
   Axel.


Other related posts: