Loop Perforation (2019)(cs.cornell.edu) |
Loop Perforation (2019)(cs.cornell.edu) |
If the for loop is calculating a sum, but that value only needs to be over a threshold, there is no reason to add the whole thing, you need a proper sample size and distribution and that it what Loop Perforation is giving you in this case.
n(n+1)/2.
Fixed that for you. No loops, and it's exact. Pick a better example.