# Re: Compiling Ruby w/ Profile Guided Optimization

**URL:** <https://www.ruby-forum.com/t/re-compiling-ruby-w-profile-guided-optimization/94818>\
**Category:** Ruby\
**Created:** [May 15, 2006, 6:23pm UTC](https://www.ruby-forum.com/t/re-compiling-ruby-w-profile-guided-optimization/94818 "2006-05-15T18:23:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 15, 2006, 6:23pm UTC](https://www.ruby-forum.com/t/re-compiling-ruby-w-profile-guided-optimization/94818/1 "2006-05-15T18:23:44Z")

</div>

> 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

Odd, I thought Ruby died a horrible death if compiled with -O3. Has  
that changed with gcc 4.x?

Thanks,

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 15, 2006, 9:03pm UTC](https://www.ruby-forum.com/t/re-compiling-ruby-w-profile-guided-optimization/94818/2 "2006-05-15T21:03:46Z")

</div>

On May 15, 2006, at 9:20 AM, Berger, Daniel wrote:

> > YMMV. I compiled a version of Ruby-1.8.4 using the  
> > following config options…
> > 
> > ```
> > configure CFLAGS="-O3 -fprofile-generate"
> > 
> > ```
> > 
> > LDFLAGS=-fprofile-generate
> 
> Odd, I thought Ruby died a horrible death if compiled with -O3. Has  
> that changed with gcc 4.x?

On OS X Ruby can fail when compiled with -fschedule-insns2 which is  
in -O2.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)
