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

J

Jay Jruby

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
 
B

Brian Candler

Jay said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top