Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gcc, spectral-norm benchmark faster without optimizations

32 views
Skip to first unread message

Melzzzzz

unread,
Oct 3, 2012, 7:02:03 PM10/3/12
to
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

Ike Naar

unread,
Oct 4, 2012, 2:59:44 AM10/4/12
to
On 2012-10-03, Melzzzzz <m...@zzzzz.com> wrote:
> 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 ?

Melzzzzz

unread,
Oct 4, 2012, 6:37:09 AM10/4/12
to
On Thu, 4 Oct 2012 06:59:44 +0000 (UTC)
Ike Naar <i...@iceland.freeshell.org> wrote:

>
> 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.


0 new messages