I'd say that resize_array grows the array with 100%, i.e. it doubles the size. Also note that mappings (and the new multiset implementation) use the same strategy, i.e. they double the size when they grow, and they shrink to 25% when less than that is used.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-01-29 01:07: Subject: Re: reasons why pike is better than python?
In the last episode (Jan 29), Martin Baehr said:
On Tue, Jan 28, 2003 at 08:25:03PM +0100, Martin Nilsson (Ã skblod) @ Pike (-) developers forum wrote:
There are of course dos and donts in Pike as well, but we try to adress them in the optimizer when we find them.
details? what about appending elements to an array vs a mapping? the latter is supposed to be faster (some people claim anyways)
When array_append has to resize an array, it grows it by 50%, so apart from a bit of wasted memory on large arrays I think it's very efficient. It also depends on what your data is and what you're going to do with it. If the index of your mapping is not an integer, you really can't put it in an array anyhow.
-- Dan Nelson dnelson@allantgroup.com
/ Brevbäraren