News for hackers. Stuff that matters.
Re:One Billion Nested Loop Iterations by nickforr on Tuesday November 26, 2024 @06:41PM (#42251375)
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

There are no comments on this comment yet.