Joel VanderWerf wrote:
> Hugh Sasse wrote:
>> My active record based script is taking longer than I'd like.
>> While I wait for approval to get a faster machine :-) I'm wondering
>> about rebuilding ruby 1.8.2 (which I have now) and changing the
>> CFLAGS from the default
>> CFLAGS=-g -O2
>> to
>> CFLAGS=-O3
>> or something of the sort.  I'm presently using gcc-3.4.3 on
>> Solaris9.  Has anyone done this and if so is there anything I should
>> watch out for?  ISTR reported problems when building other packages
>> with high -O values in the past.
>>
>> Would the answer be different for gcc-4.0.2?
>
> If gcc-4.x is an option, try it. Anecdotally, it's substantially
> faster than 3.x. In fact, it's one less reason for me to use msvc on
> windows: code compiled with gcc-4.0 (with -O2) turns out to be faster
> than msvc for some numerically intensive simulation code running as a
> ruby extension, whereas msvc was faster than gcc-3.x output code.
> YMMV.

If Hugh is using ActiveRecord intensively with a database then it's most
likely that he'll see no positiv performance effect from compiling it with
more aggressive optimization.

In fact it's likely that careful optimization on the database side will
yield better results.  This can be as easy as creating some indexes - but
might be much more complicated - depending on the bottleneck.  (Often it's
IO and this might have several reasons, from sub optimal execution plans
to slow disks / controllers.)

Kind regards

    robert