kojiishi wrote:

>> these arrays grow themselves exponentially

> Are you sure about this? Where did you get this information?

> As far as I can tell by looking at mscorlib.dll using dis-compiler,
> ArrayList.Add() uses:
>         if (this._size == (int) this._items.Length)
>                 this.EnsureCapacity(this._size + 1);

Looking at EnsureCapacity (my CIL sucks, so I hope this isn't wrong), it
appears to have the following logic:

- if the capacity is already >= the specified value, then do nothing
- if the capacity now is 0, use "16" as a comparison; otherwise, use "2x"
  the current capacity as the comparison
- if the requested size is less than the comparison value, then grow the
  container size to the comparison value; otherwise, grow it to the given
  value.

So it looks exponential to me...

Brad

--
Read my web log at http://www.quality.nu/dotnetguy/

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to