In my development env, I was working on a module in my rails app. This
action was taking approximately 7 seconds to complete. I was adding in
tracing marks to figure out where which actions were taking the longest.
All of a sudden, almost literally out of nowhere, the action starts
taking 15-19 seconds to complete.
I investigated this issue by Benchmarking virtually the entire scope of
AR save and callbacks.
It turns out that in my callbacks I reference other AR model classes.
And apparently because rails reloads model classes on each action in
development, it takes about .25 seconds just to run g = Photo. Normally
this action should take 0.0 seconds.
Im sure I was in development the entire time because prod and test don’t
work on my dev workstation.
This is very odd. The behavior of this really was out of nowhere
because all I was doing was adding Benchmark.realtime to do some
harmless benchmarking, and now I can’t get it so that AR models dont
have to reload each time a AR model is called, or atleast not take .25
seconds each time it is called.
How can I get my rails app to working so it doesnt take so long just to
call “Photo” or “Book” AR model.