Ruby Forum Redcloth > remove compilation optimization flag

Posted by Gaspard Bucher (gazoduc)
on 27.02.2008 07:39
(Received via mailing list)
top output (compilation took about 10 minutes)
  # cc1          8.6%  5:13.31   1    13   365   730M+ 2.45M   519M- 
1.13G

time to run all tests (3rd launch):
real    0m2.713s
user    0m1.321s
sys     0m0.306s

Without optimization flag (compilation takes 30 seconds):
# cc1         84.0%  0:17.15   1    13   203   243M+ 4.42M   245M+ 
435M+

time to run all tests (3rd launch)
real    0m2.560s
user    0m1.323s
sys     0m0.319s

I think it would be a good change, especially when people compile this
on a server with limited memory and shared CPU resources...

PATCH:
Index: ext/superredcloth_scan/extconf.rb
===================================================================
--- ext/superredcloth_scan/extconf.rb  (revision 245)
+++ ext/superredcloth_scan/extconf.rb  (working copy)
@@ -1,9 +1,6 @@
 require 'mkmf'

-if /darwin9/ =~ RUBY_PLATFORM
-  # OSX 10.5 doesn't like the default "-Os"
-  $CFLAGS << " -O1 "
-end
+$CFLAGS << " -O0 " # do not optimize (takes too much memory and
performance gain is negligeable)

 dir_config("superredcloth_scan")
 have_library("c", "main")
Posted by Jason Garber (Guest)
on 27.02.2008 18:27
(Received via mailing list)
Gaspard:
Hey, wow!  You're my new favorite person.  I'd been commenting out
nonessentials when I was working on something specific and just
waiting the 10 minutes when I wanted to see the whole thing work.

I'm committing this change.  Johan, since you're the one who
requested the -O1 flag, would you verify it still works for you in
Leopard?

If anyone knows a reason it's bad to compile with -O0, now's the time
to speak up.

Great work, Gaspard!  Thanks!

Jason
Posted by why the lucky stiff (Guest)
on 28.02.2008 16:55
(Received via mailing list)
On Wed, Feb 27, 2008 at 12:22:54PM -0500, Jason Garber wrote:
> I'm committing this change.  Johan, since you're the one who  
> requested the -O1 flag, would you verify it still works for you in  
> Leopard?

I agree, nice tweak!  I'm playing with the Ragel flags and noticing
wildly different behaviors as well.  (Using -G0, -T0, -T1, etc.
instead of -G2.)  I'd really like to assemble a rake tasks that
would go through and try permutations of Ragel flags with GCC flags
and determine the most optimal settings.

For sure, though, compilation time was getting ridiculous.

_why
Posted by Gaspard Bucher (gazoduc)
on 28.02.2008 17:25
(Received via mailing list)
While trying ragel optimization settings, it would be good to record
the size of the output files, since I think it would be nice to
include these files in the gem in order to avoid ragel dependency for
those not modifying the gem.

Gaspard

2008/2/28, why the lucky stiff <why@hobix.com>: