Ето...
Някой ми беше казал, че gcc -O3 е по-добре от gcc -O2 щото L2 кеша ми бил доста голям. В случая - 1МБ.
Не ги разбирам много тея работи с програмирането но тогава търсех начин да го тествам но не открих.
Е, сега го тествах и май наистина е по добре
'>))
joro@najoro:~/cpp$ uname -a
Linux najoro 2.6.8-2-k7 #1 Sat Jan 8 15:48:58 EST 2005 i686 GNU/Linux
joro@najoro:~/cpp$ cat /etc/debian_version
3.1
joro@najoro:~/cpp$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 4
model name : AMD Athlon 64 Processor 3000+
stepping : 8
cpu MHz : 1795.513
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow
bogomips : 3555.32
joro@najoro:~$ gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)
Copyright © 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
joro@najoro:~/cpp$ gcc -Wall -O0 -o test-O0 test.c
joro@najoro:~/cpp$ gcc -Wall -O1 -o test-O1 test.c
joro@najoro:~/cpp$ gcc -Wall -O2 -o test-O2 test.c
joro@najoro:~/cpp$ gcc -Wall -O3 -o test-O3 test.c
joro@najoro:~/cpp$ gcc -Wall -O3 -funroll-loops -o test-O3-unroll test.c
joro@najoro:~/cpp$ time ./test-O0
res = 4e+38
real 0m4.332s
user 0m4.224s
sys 0m0.002s
joro@najoro:~/cpp$ time ./test-O1
res = 4e+38
real 0m2.929s
user 0m2.807s
sys 0m0.002s
joro@najoro:~/cpp$ time ./test-O2
res = 4e+38
real 0m2.871s
user 0m2.727s
sys 0m0.000s
joro@najoro:~/cpp$ time ./test-O3
res = 4e+38
real 0m1.903s
user 0m1.848s
sys 0m0.000s
joro@najoro:~/cpp$ time ./test-O3-unroll
res = 4e+38
real 0m1.855s
user 0m1.825s
sys 0m0.000s