########################################## gcc -O pretest.c -o pretest gcc -O testpost.c -o testpost time pretest: 1. 0m3.274s 2. 0m3.249s 3. 0m3.298s time testpost: 1. 0m3.126s 2. 0m3.088s 3. 0m3.089s ########################################## gcc -O0 pretest.c -o pretest gcc -O0 testpost.c -o testpost time pretest: 1. 0m10.891s 2. 0m10.924s 3. 0m10.929s time testpost: 1. 0m11.487s 2. 0m11.313s 3. 0m11.359s ########################################## gcc -O1 pretest.c -o pretest gcc -O1 testpost.c -o testpost time pretest: 1. 0m3.275s 2. 0m3.311s 3. 0m3.374s time testpost: 1. 0m3.379s 2. 0m3.231s 3. 0m3.577s ########################################## gcc -O2 pretest.c -o pretest gcc -O2 testpost.c -o testpost time pretest: 1. 0m3.137s 2. 0m3.241s 3. 0m3.325s time testpost: 1. 0m2.915s 2. 0m3.032s 3. 0m2.968s ########################################## gcc -O3 pretest.c -o pretest gcc -O3 testpost.c -o testpost time pretest: 1. 0m2.629s 2. 0m2.628s 3. 0m2.599s time testpost: 1. 0m3.264s 2. 0m3.344s 3. 0m3.250s ########################################## gcc -O3 -fomit-frame-pointer pretest.c -o pretest gcc -O3 -fomit-frame-pointer testpost.c -o testpost time pretest: 1. 0m2.714s 2. 0m2.567s 3. 0m2.582s time testpost: 1. 0m4.382s 2. 0m4.383s 3. 0m4.396s ########################################## ## pretest.c ## ########################################## #include char arr1[] = "Hello World!\n"; char arr2[] = "Hello World!\n"; void copy(char arrX[], char arrY[]) { *arrX = *arrY; while((*(++arrX) = *(++arrY)) != '\0') ; } int main() { int i; for(i = 0; i < 100000000; ++i) { copy(arr1, arr2); } return 0; } ########################################## ## testpost.c ## ########################################## #include char arr1[] = "Hello World!\n"; char arr2[] = "Hello World!\n"; void copy(char arrX[], char arrY[]) { while((*arrX++ = *arrY++) != '\0') ; } int main() { int i; for(i = 0; i < 100000000; ++i) { copy(arr1, arr2); } return 0; }