Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Array appends are quadratic



On Sat, 28 Nov 2015 18:05:17 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> The effort involved in implementing the redoubling allocation (for the
> other problem indicated in 37236) would be similar: mainly having the
> array remember the number of allocated slots.  I'll have to track done
> all places in the code that allocate/reallocate arrays, hopefully there
> aren't too many.

I suspect (though I haven't actually done a search) you're out of luck
here, as there's a wide assumption that null-terminated char **'s are
the the way to carray a fixed number of elements with generic contents
that might get presented to the user.  See for example the number of
uses of mkarry().

Not allocating when the size hasn't changed should be much easier and is
easy to test for.

pws



Messages sorted by: Reverse Date, Date, Thread, Author