Gaspard Bucher
2009-Feb-12 09:36 UTC
DynamicFinderMatch & Co in callbacks chain is a waste
If anyone is working on the callback chain (Yehuda is, I think), is there a chance that the callback chain avoids calls to "respond_to?" on class objects in order to skip the DynamicFinder stuff ? These calls quickly add up. Typical Node.update_attributes (2 models involved) : 53 calls ! Gaspard --------- store_full_sti_class store_full_sti_class before_validation_callback_chain before_validation_callback_chain before_validation_callback_chain store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class before_validation_on_update_callback_chain before_validation_on_update_callback_chain before_validation_on_update_callback_chain validate_callback_chain validate_callback_chain validate_callback_chain validate_on_update_callback_chain validate_on_update_callback_chain validate_on_update_callback_chain after_validation_callback_chain after_validation_callback_chain after_validation_callback_chain after_validation_on_update_callback_chain after_validation_on_update_callback_chain after_validation_on_update_callback_chain before_save_callback_chain before_save_callback_chain before_save_callback_chain before_update_callback_chain before_update_callback_chain before_update_callback_chain partial_updates partial_updates partial_updates partial_updates partial_updates partial_updates after_update_callback_chain after_update_callback_chain after_update_callback_chain after_save_callback_chain after_save_callback_chain after_save_callback_chain store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class store_full_sti_class --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2009-Feb-12 19:06 UTC
Re: DynamicFinderMatch & Co in callbacks chain is a waste
> If anyone is working on the callback chain (Yehuda is, I think), is > there a chance that the callback chain avoids calls to "respond_to?" > on class objects in order to skip the DynamicFinder stuff ? > > These calls quickly add up. Typical Node.update_attributes (2 models > involved) : 53 calls !Do you have a benchmark in mind which shows where this is a problem? Counting method calls is fun if you buy into the reddit meme that calling methods is inherently slow. But even 53 methods will be dwarfed by rendering a single ERB template.> > Gaspard > > --------- > > store_full_sti_class > store_full_sti_class > before_validation_callback_chain > before_validation_callback_chain > before_validation_callback_chain > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > before_validation_on_update_callback_chain > before_validation_on_update_callback_chain > before_validation_on_update_callback_chain > validate_callback_chain > validate_callback_chain > validate_callback_chain > validate_on_update_callback_chain > validate_on_update_callback_chain > validate_on_update_callback_chain > after_validation_callback_chain > after_validation_callback_chain > after_validation_callback_chain > after_validation_on_update_callback_chain > after_validation_on_update_callback_chain > after_validation_on_update_callback_chain > before_save_callback_chain > before_save_callback_chain > before_save_callback_chain > before_update_callback_chain > before_update_callback_chain > before_update_callback_chain > partial_updates > partial_updates > partial_updates > partial_updates > partial_updates > partial_updates > after_update_callback_chain > after_update_callback_chain > after_update_callback_chain > after_save_callback_chain > after_save_callback_chain > after_save_callback_chain > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > store_full_sti_class > > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Gaspard Bucher
2009-Feb-12 21:47 UTC
Re: DynamicFinderMatch & Co in callbacks chain is a waste
You are right. I need to change my assembler thinking mind. Sorry for that. Gaspard On Thu, Feb 12, 2009 at 8:06 PM, Michael Koziarski <michael@koziarski.com> wrote:> >> If anyone is working on the callback chain (Yehuda is, I think), is >> there a chance that the callback chain avoids calls to "respond_to?" >> on class objects in order to skip the DynamicFinder stuff ? >> >> These calls quickly add up. Typical Node.update_attributes (2 models >> involved) : 53 calls ! > > Do you have a benchmark in mind which shows where this is a problem? > Counting method calls is fun if you buy into the reddit meme that > calling methods is inherently slow. But even 53 methods will be > dwarfed by rendering a single ERB template. > >> >> Gaspard >> >> --------- >> >> store_full_sti_class >> store_full_sti_class >> before_validation_callback_chain >> before_validation_callback_chain >> before_validation_callback_chain >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> before_validation_on_update_callback_chain >> before_validation_on_update_callback_chain >> before_validation_on_update_callback_chain >> validate_callback_chain >> validate_callback_chain >> validate_callback_chain >> validate_on_update_callback_chain >> validate_on_update_callback_chain >> validate_on_update_callback_chain >> after_validation_callback_chain >> after_validation_callback_chain >> after_validation_callback_chain >> after_validation_on_update_callback_chain >> after_validation_on_update_callback_chain >> after_validation_on_update_callback_chain >> before_save_callback_chain >> before_save_callback_chain >> before_save_callback_chain >> before_update_callback_chain >> before_update_callback_chain >> before_update_callback_chain >> partial_updates >> partial_updates >> partial_updates >> partial_updates >> partial_updates >> partial_updates >> after_update_callback_chain >> after_update_callback_chain >> after_update_callback_chain >> after_save_callback_chain >> after_save_callback_chain >> after_save_callback_chain >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> store_full_sti_class >> >> > >> > > > > -- > Cheers > > Koz > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2009-Feb-13 08:30 UTC
Re: DynamicFinderMatch & Co in callbacks chain is a waste
Gaspard Bucher wrote:> You are right. I need to change my assembler thinking mind. Sorry for that.This could still be a problem, we''d just need to run a full benchmark to see the impact. -- Cheers, Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---