I had the same thought. Could just make a new AbstractArray which keeps a larger array and tracks the current usage. I bet it's 10 lines of code to make it generic.
On Thursday, July 21, 2016, Christoph Ortner <christophortn...@gmail.com> wrote: > > feels like one may want a little auxiliary package that can make available > small chunks from a long pre-allocated vector. > > On Thursday, 21 July 2016 10:37:12 UTC+1, Chris Rackauckas wrote: >> >> Maybe. I thought about that, but I don't think that satisfies the >> "elegant and compactness" requirement, unless there's an easy way to do the >> growing without too much extra code hanging around. >> >> On Thursday, July 21, 2016 at 1:54:10 AM UTC-7, Christoph Ortner wrote: >>> >>> could still preallocate and grow as needed? >>> >>> On Thursday, 21 July 2016 02:48:58 UTC+1, Chris Rackauckas wrote: >>>> >>>> Most of the arrays are changing size each time though, since they >>>> represent a population which changes each timestep. >>>> >>>> On Wednesday, July 20, 2016 at 6:47:39 PM UTC-7, Steven G. Johnson >>>> wrote: >>>>> >>>>> It looks like you are allocating lots of arrays in your doStep >>>>> inner-loop function, so I'm sure you could improve it by moving the >>>>> allocations out of the inner loop. (In general, vectorized routines are >>>>> convenient but they aren't the fastest way to do things.) >>>>> >>>>