help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic allocation of cell arrays is sloooow


From: Carnë Draug
Subject: Re: dynamic allocation of cell arrays is sloooow
Date: Wed, 16 Mar 2016 15:23:40 +0000

On 16 March 2016 at 12:17, Francesco Potort? <address@hidden> wrote:
>
> Dynamic allocation of array-like data structures is inherently
> inefficient, but sometimes it vastly simplifies coding, especially when
> the total size of the data structure is unknown in advance.
>
> Octave does a good job at doing dynamic allocation of arrays, but is
> apparently very inefficient when cell arrays or struct arrays are
> involved.  Here is a simple benchmark:
>
> [...]
>
> I find myself in the latter case: a struct array with around a million
> entries.  The only reasonable way I found is to do excess initial
> allocation and then delete the excess entries at the end.  Is this the
> recommended way?
>

There is a data-structures package that is meant to provide alternatives
to the Octave fixed length arrays.  At the moment, it only has stack which
is meant to improve performance for appending to the data.  It is has
seen limited testing and never released, but may be of interest to you:

    https://sourceforge.net/p/octave/data-structures

Carnë



reply via email to

[Prev in Thread] Current Thread [Next in Thread]