gcc, spectral-norm benchmark faster without optimizations

M

Melzzzzz

This program
http://shootout.alioth.debian.org/u64q/program.php?test=spectralnorm&lang=gpp&id=6
is faster when compiling without optimisations

centos 6.3, gcc 4.4.6, Q6600 @ 2.4Ghz

[bmaxa@bmaxa spectral-norm]$ g++ -Wall -O0 -msse2 -fopenmp spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment
[bmaxa@bmaxa spectral-norm]$ time ./spectralcpp 5500
1.274224153

real 0m1.996s
user 0m7.963s
sys 0m0.004s
[bmaxa@bmaxa spectral-norm]$ g++ -Wall -O3 -msse2 -fopenmp spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment
[bmaxa@bmaxa spectral-norm]$ time ./spectralcpp 5500
1.274224153

real 0m2.528s
user 0m10.090s
sys 0m0.005s

ubuntu 12.04, gcc 4.6.3, i5 3570k @ 4Ghz

bmaxa@maxa:~/shootout/spectral-norm$ g++ -Wall -fopenmp -O0 -msse2 spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment [-Wcomment]
bmaxa@maxa:~/shootout/spectral-norm$ time ./spectralcpp 5500
1.274224153

real 0m0.799s
user 0m3.040s
sys 0m0.000s
bmaxa@maxa:~/shootout/spectral-norm$ g++ -Wall -fopenmp -O3 -msse2 spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment [-Wcomment]
bmaxa@maxa:~/shootout/spectral-norm$ time ./spectralcpp 5500
1.274224153

real 0m1.186s
user 0m4.536s
sys 0m0.000s

(I tried with gcc 4.7 and snapshot 4.8 same result)

curiosly, 32 bit version optimizer works ;)

bmaxa@maxa:~/shootout/spectral-norm$ g++ -Wall -fopenmp -O3 -m32 -msse2 spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment [-Wcomment]
bmaxa@maxa:~/shootout/spectral-norm$ time ./spectralcpp 5500
1.274224153

real 0m0.635s
user 0m2.368s
sys 0m0.004s

So what do you think? Is it bug in 64 bit optimizer or something which
I overlooked?

Thanks
 
I

Ike Naar

This program
http://shootout.alioth.debian.org/u64q/program.php?test=spectralnorm&lang=gpp&id=6
is faster when compiling without optimisations

centos 6.3, gcc 4.4.6, Q6600 @ 2.4Ghz

[bmaxa@bmaxa spectral-norm]$ g++ -Wall -O0 -msse2 -fopenmp spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment
[bmaxa@bmaxa spectral-norm]$ time ./spectralcpp 5500
1.274224153

real 0m1.996s
user 0m7.963s
sys 0m0.004s
[bmaxa@bmaxa spectral-norm]$ g++ -Wall -O3 -msse2 -fopenmp spectral.cpp -o spectralcpp
spectral.cpp:10:1: warning: multi-line comment
[bmaxa@bmaxa spectral-norm]$ time ./spectralcpp 5500
1.274224153

real 0m2.528s
user 0m10.090s
sys 0m0.005s

The -O3 optimizations can make code bigger, which *can* have
negative impact on the running speed.
Have you tried -O2 ?
 
M

Melzzzzz

The -O3 optimizations can make code bigger, which *can* have
negative impact on the running speed.
Have you tried -O2 ?

Yes, I have tried, same result.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top