gcc, spectral-norm benchmark faster without optimizations

Discussion in 'C++' started by Melzzzzz, Oct 4, 2012.

  1. Melzzzzz

    Melzzzzz Guest

    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
    Melzzzzz, Oct 4, 2012
    #1
    1. Advertising

  2. Melzzzzz

    Ike Naar Guest

    On 2012-10-03, Melzzzzz <> 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 ?
    Ike Naar, Oct 4, 2012
    #2
    1. Advertising

  3. Melzzzzz

    Melzzzzz Guest

    On Thu, 4 Oct 2012 06:59:44 +0000 (UTC)
    Ike Naar <> 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.
    Melzzzzz, Oct 4, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duncan Lissett

    make faster Richards benchmark

    Duncan Lissett, May 13, 2004, in forum: Python
    Replies:
    15
    Views:
    774
    Duncan Lissett
    May 14, 2004
  2. Simon Wittber

    RE: make faster Richards benchmark

    Simon Wittber, May 14, 2004, in forum: Python
    Replies:
    4
    Views:
    298
    Duncan Lissett
    May 17, 2004
  3. highegg

    std::norm defect?

    highegg, Mar 2, 2009, in forum: C++
    Replies:
    29
    Views:
    1,324
  4. Tito Ciuro
    Replies:
    13
    Views:
    204
    Alex Young
    Oct 20, 2007
  5. Richard
    Replies:
    4
    Views:
    120
    Grant Wagner
    Jan 24, 2005
Loading...

Share This Page