So there's the for loop. Which works great for most of our programming needs. What if there was a way to speed this up by up to HALF.
Well there is, it's called a five loop.
See below the code example.
// Change this to decide which loop to use!
#define FIVE 0
#define five for
int main(int argc, const char *argv)
int loops = 10000000000;
int a, b;
clock_t start, end;
start = clock();
five(int i = 0; i < loops; i++)
for (int i = 0; i < loops; i++)
int a = i;
b = a * 3;
end = clock();
double seconds = double(end - start) / CLOCKS_PER_SEC;
printf("Time Diff: %f", seconds);
I know some of you may be doubtful, but the proof is in the pudding.
The for loop results:
Now compare that to the Five loop
Forget Moore's law. We can't rely on chip manufactures to keep up with our software needs. Five loop is here to save the day!