Development performance
The runtime performance of hmp is killing me in development mode. How can we make this better? Code generation maybe? I'm willing to help build it.
What part of it is slow?
I have this declaration:
acts_as_double_polymorphic_join(
:parents => [:pages],
:children => [:pages] + Item.type_names(:primary => true),
:children_order => "parent_children.position ASC"
)
And every request does this:
** has_many_polymorphs: associating Page.parents
** has_many_polymorphs: associating Article.parents
** has_many_polymorphs: associating BlogPost.parents
** has_many_polymorphs: associating BuyingGuide.parents
** has_many_polymorphs: associating Calculator.parents
** has_many_polymorphs: associating Checklist.parents
** has_many_polymorphs: associating CommunityPost.parents
** has_many_polymorphs: associating CommunityDiscussion.parents
** has_many_polymorphs: associating Quiz.parents
** has_many_polymorphs: associating MedicareInformation.parents
** has_many_polymorphs: associating News.parents
** has_many_polymorphs: associating Poll.parents
** has_many_polymorphs: associating Question.parents
** has_many_polymorphs: associating Task.parents
** has_many_polymorphs: associating Tip.parents
** has_many_polymorphs: associating ToDoList.parents
** has_many_polymorphs: associating Interview.parents
** has_many_polymorphs: associating Reflection.parents
** has_many_polymorphs: preloading parent model Tag
** has_many_polymorphs: associating Tag.taggables
There is some env flag that causes it to generate code, which you could paste in...otherwise...cache_classes = true?
I tried caching classes. it's not a better solution. The acts_as_double_polymorphic_join declaration rarely changes... it seems silly to do a bunch of work with every request instead of when the declaration changes.
I saw the code generation stuff. I was wondering if we could productize that with some rake tasks, etc.
That seems like it would work...optional way to cache the declarations only, basically.
are the "declarations" the hard work that hmp performs?
yeah...setting up all the association declarations for you.