Skip to content

Instantly share code, notes, and snippets.

@morganwilde
Created September 25, 2013 20:03
Show Gist options
  • Save morganwilde/6705234 to your computer and use it in GitHub Desktop.
Save morganwilde/6705234 to your computer and use it in GitHub Desktop.
speed
#include <stdio.h>
#include <time.h>
int main() {
// time it
clock_t cstart = clock();
clock_t cend = 0;
int i, j, k;
int sum = 0;
int count = 0;
for (i = 0; i < 100; i++) {
for (j = 0; j < 100; j++) {
for (k = 0; k < 100; k++) {
sum = i*k*j;
count++;
printf("[%d] - %d\n", count, sum);
}
}
}
cend = clock();
printf("%.3f cpu sec\n", ((double)cend - (double)cstart)*1.0e-6);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment