Performance optimization (allocation inside a for loop)
Francesco Potorti`
Potorti at isti.cnr.it
Tue Apr 7 08:48:47 CDT 2009
>I gave the idea a second thought - maybe it has some merits. Sometimes
>you really want to use an array as a stack in Octave to avoid going
>through a loop twice, so Octave can try to optimize such usage.
Two thoughts only:
1) if stack operations are one target of this optimisation, then it
would better to have a hysteresis behaviour, that is, deallocate
one chunk only when the free space is 2*chunk big; more generally,
deallocate so that at least a whole unused chunk remains unused
2) 1kB for chunk size is very little today. I would have considered
one memory page size at least, but since marginal improvements are
smaller for big chunks, maybe the current choice is good. Only a
benchmark can tell, I suppose.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa Email: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
More information about the Help-octave
mailing list