Loop perforation

Loop perforation is an approximate computing technique that allows to regularly skip some iterations of a loop.[1]

It relies on one parameter: the skip factor. The skip factor can either be interpreted as the number of iteration to skip each time or the number of iterations to perform before skipping one.

Code examples

The examples that follows provide the result of loop perforation applied on this C-like source code

for (int i = 0; i < N; i++) {
    // do things
}

Skip n iterations each time

for (int i = 0; i < N; i++) {
    // do things
    i = i + skip_factor;
}

Skip one iteration after n

int count = 0;
for (int i = 0; i < N; i++) {
    if (count == skip_factor) {
        count = 0;
    } else {
        // do things
        count ++;
    }
}
gollark: We're going all Lua here, for purposes.
gollark: Fiiiine, we can reexist forms, but they're subject to cross-origin requirements and they send Lua table notation instead of (ew) x-www-form-urlencoded.
gollark: You could have a "please screen-read it as this" attribute, but then nobody will actually set it, as happens now.
gollark: Like I said, if you just break out all the various web bits into separate protocols, you then have to deal with irritating things like enforcing the same security on each, actually tying them together into one system to do what you want (because you quite plausibly want the file upload/download bits to be part of the same service), lots of open ports and possibly different server software, and implementing similar protocols over and over again.
gollark: No. They use multipart.

See also

Notes

References

  1. Mittal, Sparsh (May 2016). "A Survey of Techniques for Approximate Computing". ACM Comput. Surv. ACM. 48 (4): 62:1–62:33. doi:10.1145/2893356.


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.