[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

why a require 'activerecord' takes up to 1 second?

Jay Jruby

3/29/2009 5:30:00 PM

Hi rubyers, this is my first post here.

Ok, I might not have the best machine in the World (Intel 2.66Mhz 1 CPU)
but I am doing some
"profiling" and realized that a "require 'activerecord'" is taking about
1 second to perform.

I'm using ERuby, I've tried FastEruby/Erubis but without any noticeable
gain.

Any idea why this particular class is so heavy to load?
Would mod_ruby help?

Thank you,
Jay
--
Posted via http://www.ruby-....

1 Answer

Brian Candler

3/30/2009 8:33:00 AM

0

Jay Jruby wrote:
> Hi rubyers, this is my first post here.
>
> Ok, I might not have the best machine in the World (Intel 2.66Mhz 1 CPU)

It's a long time since I used a machine as slow as 2.66MHz. Even the
original IBM PC-XT was 4.77MHz :-)

> but I am doing some
> "profiling" and realized that a "require 'activerecord'" is taking about
> 1 second to perform.
>
> I'm using ERuby, I've tried FastEruby/Erubis but without any noticeable
> gain.
>
> Any idea why this particular class is so heavy to load?

Look at its dependencies. e.g. try "require 'activesupport'" before
"require 'activerecord'" and time those two separately.

You could also try it without rubygems, e.g. instead of require
"rubygems" do
$:.unshift "/usr/lib/ruby/1.8/gems/1.8/activesupport-2.3.2/lib"
$:.unshift "/usr/lib/ruby/1.8/gems/1.8/activerecord-2.3.2/lib"
... etc

This is also a good way to find out what gem dependencies you have.

Regards,

Brian.
--
Posted via http://www.ruby-....