Re: [Rcpp-devel] Caching temporary results in long chains.

2010-12-09 Thread Whit Armstrong
unless you are preallocating space to store your answer, then every reassignment could potentially cause the whole vector to be reallocated. if you know in advance how many runs you will do, and the thinning, then preallocate the vector and assign into it. Alternatively, implement your mcmc model

[Rcpp-devel] Caching temporary results in long chains.

2010-12-09 Thread Andrew Redd
I'm having a problem with running long MCMC chains. When I run the chain for 1000 runs it takes about 30 seconds --- > n<-1e3 > time1<- system.time({ + run1 <- d3$run(n, 1,1, 1,1, 50) + }) > time1 user system elapsed 30.120 0.950 31.105 --- When I run for 100 000 runs I should expect so