help-octave
[Top][All Lists]
Advanced

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

Re: Migrating from 3.6.4 to 3.8.0


From: Philip Nienhuis
Subject: Re: Migrating from 3.6.4 to 3.8.0
Date: Sun, 16 Feb 2014 09:37:16 -0800 (PST)

Michael, please keep list cc'd so others can benefit as well


Michael Pender wrote
> When I need to either use large arrays or a lot of memory to the point 
> that I'm near the limit of what the system can provide, then I usually 
> preallocate a space and reuse the same buffer repeatedly instead of 
> releasing the variable space and requesting new memory.  Reusing the 
> same memory tends to be significantly faster as well.

Yes thanks, that's another useful trick. 

Some remarks (inspired by occasions where I saw this being applied):
- As soon as multiple big arrays come into play simultaneously, some careful
bookkeeping is needed to put them in the right place in the buffer. 
- For arrays of different class (byte size) this can get wasteful as results
are cast to the largest byte size (in the OP's case: (I suppose:) uint16 (2
bytes) -> 8 byte doubles).
- Such preallocated space isn't inaccessible (out of scope) from within
(Octave) functions that need memory for scratch arrays; so in some rare
cases the out-of-memory errors occur there.

That said, for user function output (like in the OP's case: output from
imresize) it is definitely worth a try.

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Migrating-from-3-6-4-to-3-8-0-tp4661903p4661935.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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