help-octave
[Top][All Lists]
Advanced

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

Re: Performance optimization (allocation inside a for loop)


From: Francesco Potorti`
Subject: Re: Performance optimization (allocation inside a for loop)
Date: Wed, 08 Apr 2009 09:59:25 +0200

>>  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
>
>Currently, the behaviour is that pop *never* reallocates. 

Ok, so my first observation is already satisfied.

>>  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.
>
>No problem. Feel free to do any benchmarks and suggest a better size
>or even a better strategy. 1024 (i.e. 8kB for a double array) should
>cut the amount of reallocations down by a factor 1000, so it seemed
>enough to me.

I had understood 1KiB rather than 1Ki elements, so my second observation
is already satisfied, too.

Thanks

-- 
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: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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