Created
July 9, 2012 13:27
-
-
Save mactkg/3076555 to your computer and use it in GitHub Desktop.
はいれつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <limits.h> | |
#define NUM 100000 | |
#define N 2147483647L | |
int main(void){ | |
long long int i; | |
clock_t start,end; | |
char a[NUM]; | |
char b[NUM/100]; | |
for(i = 0; i < NUM; i++) | |
a[i] = 'a'; | |
for(i = 0; i < NUM/100; i++) | |
b[i] = 'b'; | |
start = clock(); | |
for(i = 0; i < N; i++) | |
strlen(a); | |
end = clock(); | |
printf("a:%.20f\n", (double)(end-start)); | |
start = clock(); | |
for(i = 0; i < N; i++) | |
strlen(b); | |
end = clock(); | |
printf("b:%.20f\n", (double)(end-start)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a:5466927.00000000000000000000
b:5391424.00000000000000000000