Revamp BList somewhat to further optimize the resizing behavior.

We now keep track of a lower bound as to when the list should scale
itself back down. When increasing the list size, we double the current,
with the lower bound set to 1/4 of the current size, not allowing it to
go any smaller than the block size. These combined allow us to do very
cheap tests to see if an operation requires a resize at all, and minimize
how often the list actually needs to be resized, since the difference in upper
and lower bounds prevents bouncing back and forth between a size in the case
of adding/removing an item while close to a boundary. All in all this should
make BList noticably more scalable when doing large numbers of add/remove
operations.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25946 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2008-06-12 21:30:28 +00:00
parent 1b9e61ad87
commit 0c8bdbafd5
4 changed files with 120 additions and 64 deletions
+4 -4
View File
@@ -56,14 +56,14 @@ class BList {
virtual void _ReservedList1();
virtual void _ReservedList2();
bool Resize(int32 count);
bool _ResizeArray(int32 count);
private:
void** fObjectList;
size_t fPhysicalSize;
int32 fPhysicalSize;
int32 fItemCount;
int32 fBlockSize;
uint32 _reserved[2];
int32 fResizeThreshold;
uint32 _reserved[1];
};
#endif // _BE_LIST_H