Eduardo Blumenfeld
2010-Aug-07 18:21 UTC
[Ironruby-core] ActiveRecord loading veeeery slow
Hi all, I''m having a performance issue when loading activerecord: I''m timing it in this code ----------------------- puts Time.now.to_s + "rubygems" require ''rubygems'' puts Time.now.to_s + "activerecord" require ''active_record'' puts Time.now.to_s + "activesupport" require ''active_support'' #require ''acts_as_list'' puts Time.now.to_s + "yaml" require ''yaml'' ActiveRecord::Base.establish_connection( :adapter => ''sqlserver'', :database => ''db'', :username => ''sa'', :password => ''password'', :mode => ''ADONET'', :host => "machine\\instance") puts Time.now.to_s + ''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 warning? Thank you all in advance, Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/.
Eduardo Blumenfeld
2010-Aug-28 14:34 UTC
[Ironruby-core] ActiveRecord loading veeeery slow
Any Ideas? Thank you in advance Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/.
Eduardo Blumenfeld
2010-Sep-07 03:00 UTC
[Ironruby-core] ActiveRecord loading veeeery slow
Hi all, I finally figured out the problem (weird tough). It happens to be that I was using also (from the calling top-level program) 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 Microsoft::Office::Interop::Excel 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 -- Posted via http://www.ruby-forum.com/.