I would be surprised if loading the DM models takes that long, I agree, it's probably bundler doing its thing for quite some time here. There's no way around preloading all DM models before the app is used, because that is the only way we can make sure that all models are properly initialized. DM is fundamentally different from AR to that respect. It *must* know all the models, not only for STI reasons, but for generating foreign key properties and initializing relationships.
cheers snusnu On Fri, Jul 16, 2010 at 11:23, Patrik Sundberg <[email protected]> wrote: > I don't necessarily think it's the models - my bet would be on bundler/ > gems being most of the startup. > > On the preload of models, I have a recollection of preload being > needed for Single Table Inheritance to initialize properly, or rather > I think the auto require feature of active support wouldn't load > things in a way that correctly sets up STI links in DM. > > P > > On Jul 15, 7:03 pm, Kevin <[email protected]> wrote: >> I don't know how to benchmark this better, but I wonder if the >> slowness is because we preload all the models. Isn't one of the >> beauties of the rails console that it'll autoload files based on what >> you try to instantiate? >> >> from /Users/inspire/.rvm/gems/ree-1.8.7-2010.02/gems/dm-rails-1.0.0/ >> lib/dm-rails/setup.rb:47:in `preload_models' >> from /Users/inspire/.rvm/gems/ree-1.8.7-2010.02/gems/dm-rails-1.0.0/ >> lib/dm-rails/railtie.rb:83:in `_callback_before_7' >> >> By slow, I mean it takes ~6 seconds for me on a 8-core mac pro with 7 >> models (though some tricky is-remixable stuff too). >> >> Or maybe I'm all off and its something else. If you have any ideas on >> how to benchmark the startup time, let me know please :) > > -- > You received this message because you are subscribed to the Google Groups > "DataMapper" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
