Forum: Ruby on Rails ActiveRecord load time

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F50f406e6c261349179ead121e6c9a0f?d=identicon&s=25 Earle Clubb (eclubb)
on 2007-07-17 21:50
I'm using ActiveRecord outside of Rails.  The time for a script to
execute "require 'active_record'" is about 2.5 seconds on my 666 MHz
machine.  Is there any way to speed it up (aside from a faster
processor)?  Maybe some way to  pre-load ActiveRecord?  The script is
invoked by a user action, so it needs to start quickly.

Thanks,
Earle
B98a3d2feba8e225974a2bd033710618?d=identicon&s=25 Miguel Castro (Guest)
on 2007-07-18 16:21
(Received via mailing list)
Get a faster machine.
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-07-18 16:40
(Received via mailing list)
On 7/17/07, Earle Clubb <rails-mailing-list@andreas-s.net> wrote:
>
> I'm using ActiveRecord outside of Rails.  The time for a script to
> execute "require 'active_record'" is about 2.5 seconds on my 666 MHz
> machine.  Is there any way to speed it up (aside from a faster
> processor)?  Maybe some way to  pre-load ActiveRecord?  The script is
> invoked by a user action, so it needs to start quickly.

You can run it as a separate DRB process, and the user action just
connects with DRB and invokes the action.  Here's a simple Daemon
module so you can manage pids and all that:
http://snippets.dzone.com/posts/show/2265

This is how rails (using mongrel/http or fcgi instead of drb of
course) pre-loads the framework.

--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
This topic is locked and can not be replied to.