Skip to content

How do I make this faster?

3 messages · Hasan Diwan, Andreas Borg, Paul Hiemstra

2 days later
#
Hi Hasan,

I'd be happy to help you, but I am not able to run your code. You use 
commandArgs to retrieve arguments of the R program, but which ones do 
you actually provide?

Best regards,

Andreas

Hasan Diwan schrieb:

  
    
#
On 04/11/2011 10:28 AM, Andreas Borg wrote:
In this piece of code you concatenate correlation and correlations.
Because you dynamically change correllations the operating system is
looking for a spot of memory for the object often. Preallocating the
space you need, or a bit is also fine, will make this much faster. You
can do this by not creating zero-length vectors for 'correlations' and
'vectors' before the start of the loop, but creating them already at the
desired length and assign values in the loop, not concatenate. This
could possibly speed up your codes by several orders of magnitude.

cheers,
Paul