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
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
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).