Compiling Ruby w/ Profile Guided Optimization

Discussion in 'Ruby' started by Greg Buchholz, May 11, 2006.

  1. Since gcc-4.1 now has the option to perform profile guided
    optimization, I thought I'd try compiling a version of Ruby with this
    feature turned on. For the (somewhat contrived/synthetic) scenario
    below, it looks like compiling with profile guided optimization turned
    on, along with -O3, results in about a 9% speed increase vs. -O3 alone.
    YMMV. I compiled a version of Ruby-1.8.4 using the following config
    options...

    configure CFLAGS="-O3 -fprofile-generate"
    LDFLAGS=-fprofile-generate

    ....Then I ran the short version of the n-body program from the Great
    Computer Language Shootout with n=1000...


    http://shootout.alioth.debian.org/debian/benchmark.php?test=nbody&lang=ruby&id=0

    ....this generated the profile information needed for the next stage. I
    then compiled a Ruby with...

    configure CFLAGS="-O3 -fprofile-use"

    ....Running the resulting interpreter runs the exact same n-body program
    about 8-10% faster than an compiling with just -O3.

    FWIW,

    Greg Buchholz
     
    Greg Buchholz, May 11, 2006
    #1
    1. Advertising

  2. Greg Buchholz

    Phil Tomson Guest

    In article <>,
    Greg Buchholz <> wrote:
    > Since gcc-4.1 now has the option to perform profile guided
    >optimization, I thought I'd try compiling a version of Ruby with this
    >feature turned on. For the (somewhat contrived/synthetic) scenario
    >below, it looks like compiling with profile guided optimization turned
    >on, along with -O3, results in about a 9% speed increase vs. -O3 alone.
    > YMMV. I compiled a version of Ruby-1.8.4 using the following config
    >options...
    >
    > configure CFLAGS="-O3 -fprofile-generate"
    >LDFLAGS=-fprofile-generate
    >
    >...Then I ran the short version of the n-body program from the Great
    >Computer Language Shootout with n=1000...
    >
    >
    >http://shootout.alioth.debian.org/debian/benchmark.php?test=nbody&lang=ruby&id=0
    >
    >...this generated the profile information needed for the next stage. I
    >then compiled a Ruby with...
    >
    > configure CFLAGS="-O3 -fprofile-use"
    >
    >...Running the resulting interpreter runs the exact same n-body program
    >about 8-10% faster than an compiling with just -O3.
    >


    Cool! What exactly is 'profile guided optimization'?

    Phil
     
    Phil Tomson, May 11, 2006
    #2
    1. Advertising

  3. Greg Buchholz, May 12, 2006
    #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. Brad
    Replies:
    1
    Views:
    1,160
    Roedy Green
    Jul 19, 2005
  2. llothar
    Replies:
    7
    Views:
    354
    Tim Prince
    May 13, 2007
  3. Andy B
    Replies:
    0
    Views:
    546
    Andy B
    May 3, 2008
  4. Steven
    Replies:
    5
    Views:
    504
    Steven
    Oct 24, 2008
  5. Ravikiran

    Zero Optimization and Sign Optimization???

    Ravikiran, Nov 17, 2008, in forum: C Programming
    Replies:
    22
    Views:
    900
    Thad Smith
    Nov 24, 2008
Loading...

Share This Page