Robbie,
http://www.khelll.com/blog/ruby/ruby-dynamic-method-calling/ mentions
a few different ways to call a method dynamically, and
http://lojic.com/blog/2008/12/22/ruby-dynamic-method-invocation-performance/
talks about performance. I''d try instantiating the method and then
calling it, see what happens there. Can''t really offer any inside
knowledge, though, sorry.
Liam
On Jan 17, 12:10 pm, Robbie Allen
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:> My rails app has over 400 models and close to 2000 methods. I call
> Object#send in one of them and in production it takes a 10-12 seconds
> for that call to complete. In development where config.cache_classes >
false, the same call returns in less than a second. If I set
> config.cache_classes = true in development, I see the same 10 second
> lag. I tried using method/call and eval, but got similar response
> times.
>
> Does send() and its ilk do some sort of lookup or scan of all the
> methods to determine if the one I''m calling is defined? Should
that
> take 10 seconds to cover 2000 model methods?
>
> Is there some alternative to dynamically call an object''s method
that
> would avoid this issue? I''d prefer to bypass any checks and just
invoke
> the method.
>
> Note that the method I''m calling is not dynamically created...it
exists
> in the model. I just need to call it dynamically (I don''t know
which
> method to call until the code executes).
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.