Skip to content
Prev 32578 / 398530 Next

Slow computation in for loop

First of all, thank you for your response.

I actually have to refine my pseudocode. 'result' is a numerical vector of 
length 7, and is binded with whole results through an rbind() :

for (k in replicates) {
   data <- sampling from a population
   for (i in param1) {
     for (j in param2) {
        result <- function(i, j, data)
        all.results <- rbind(all.results, result)
     }
   }
}

all.result is at most a 220 rows and 7 columns data frame, which doesn't 
seem to be big enough to explain such a slow computation.

Moreover, previous computations with a sample size of 100, which took 
individually about 4 seconds at most, ran effectively in a little bit more 
than 15 minutes for the whole set.

The problem arise with a sample size of 500, increasing single function 
computation time normally, but not the whole process !?
At 11:37 28/05/03, you wrote: