Forum: IronRuby ActiveRecord loading veeeery slow

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C94afbb820c49a847b3b1f5244178f82?d=identicon&s=25 Eduardo Blumenfeld (eblumenfeld)
on 2010-08-07 20:21
Hi all,

I'm having a performance issue when loading activerecord:

I'm timing it in this code
puts + "rubygems"
require 'rubygems'
puts + "activerecord"
require 'active_record'
puts + "activesupport"
require 'active_support'
#require 'acts_as_list'
puts + "yaml"
require 'yaml'
:adapter => 'sqlserver',
:database => 'db',
:username => 'sa',
:password => 'password',
:mode => 'ADONET',
:host =>  "machine\\instance")
puts + 'classes'
...... (loads all the classes

The results are:

Sat Aug 07 13:49:08 -0400 2010rubygems
Sat Aug 07 13:49:09 -0400 2010activerecord
WARNING: YAML.add_builtin_type is not implemented
Sat Aug 07 13:49:22 -0400 2010activesupport
Sat Aug 07 13:49:22 -0400 2010yaml
Sat Aug 07 13:49:23 -0400 2010connection
Sat Aug 07 13:49:43 -0400 2010classes

as you can see the time to load activerecord is 13 seconds,
and the time to establish the connection is 20 seconds,

Once everything is established, the system really works fine
regarding response time with the database.

Is there anything I could do to improve the startup speed with
activerecord and activerecord-sqlserver-adapter standard gems?

Is there any relation with the YAML.add_builtin_type not implemented

Thank you all in advance,

Eduardo Blumenfeld
C94afbb820c49a847b3b1f5244178f82?d=identicon&s=25 Eduardo Blumenfeld (eblumenfeld)
on 2010-08-28 16:34
Any Ideas?

Thank you in advance

Eduardo Blumenfeld
C94afbb820c49a847b3b1f5244178f82?d=identicon&s=25 Eduardo Blumenfeld (eblumenfeld)
on 2010-09-07 05:00
Hi all,

I finally figured out the problem (weird tough).

It happens to be that I was using also (from the calling top-level

the following call:

load_assembly "Microsoft.Office.Interop.Excel"
include Microsoft::Office::Interop::Excel

I don't have the reason why this happened, but just by moving those
calls to a
place after the
require 'db_lib.rb'
that called the (previously) slow "connect" call,
the time went from 14 seconds to 1 second (or less)

My guess about the problem may be that by including the
the ironruby adds a huge quantity of objects to inspect
for a "method_missing" that works in the active_record gem,
specially in the establish_connection method.

Could my guess be correct?

Regards to all!!!

and keep working with IronRuby, IT ROCKS!!!

Eduardo Blumenfeld
This topic is locked and can not be replied to.