[R] memory management uestion [Broadcast]

Federico Calboli f.calboli at imperial.ac.uk
Tue Feb 20 18:36:59 CET 2007


Charles C. Berry wrote:

> 
> 
> This is a bit different than your original post (where it appeared that 
> you were manipulating one row of a matrix at a time), but the issue is 
> the same.
> 
> As suggested in my earlier email this looks like a caching issue, and 
> this is not peculiar to R.
> 
> Viz.
> 
> "Most modern CPUs are so fast that for most program workloads the 
> locality of reference of memory accesses, and the efficiency of the 
> caching and memory transfer between different levels of the hierarchy, 
> is the practical limitation on processing speed. As a result, the CPU 
> spends much of its time idling, waiting for memory I/O to complete."
> 
> (from http://en.wikipedia.org/wiki/Memory_hierarchy)
> 
> 
> The computation you have is challenging to your cache, and the effect of 
> dropping unused columns of your 'data' object by assiging the columns 
> used  to 'srow' and 'drow' has lightened the load.
> 
> If you do not know why SAXPY and friends are written as they are, a 
> little bit of study will be rewarded by a much better understanding of 
> these issues. I think Golub and Van Loan's 'Matrix Computations' touches 
> on this (but I do not have my copy close to hand to check).

Thanks for the clarifications. My bottom line is, I prefer dummy variables 
because they allow me to write cleaner code, with a shorter line for the same 
instruction i.e. less chances of creeping errors (+ turning into -, etc).

I've been challenged that that's memory inefficent, and I wanted to have the 
opinion of people with more experience than mine on the matter.

Best,

Fede

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602     Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com



More information about the R-help mailing list