3 ms·
If you write the R code using vectorised operations it’s significant orders of magnitude faster (148 seconds to 1.5 milliseconds on posit.cloud). The nested lo
by nickforr 2y ago
If you write the R code using vectorised operations it’s significant orders of magnitude faster (148 seconds to 1.5 milliseconds on posit.cloud).
The nested loop becomes:
j <- sum((seq_len(100000) - 1) %% u)
a <- a + j + r