-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up init with a refactor #37
Conversation
I'd like to see this merged. We have some large objects being pulled in via JSON and it is proving to be expensive to build all of them. Profiling reveals writer_method_defined? is responsible for a good chunk of it. |
I merged the branch into master. Tests pass, but could you guys check if everything is still working in your applications? Thanks! |
fwiw, I've been running this code in production for a month or so, no problems. |
My app is also looking solid |
Sweet. Just curious, can you tell me on what app/project you’re using Her? 😄 |
I work for CustomInk. We are moving off of ActiveResource for consuming data from our catalog management system. |
Wow, this is awesome. So glad to hear other people are using it for real 😀 |
Hopefully this makes for some clearer code inside the initialize method in
Her::Model::ORM
.Instead of using
writer_method_defined?
inside the loop, make use of ause_setter_methods
helper function which both calls setter methods and returns a hash of the remaining key / values.I did this after noticing in profiling output that significant time was being spent in
Class#instance_methods
(whichwriter_method_defined?
was using inside a loop).