Russell Norris
2007-Mar-16 13:14 UTC
Benchmarker numbers [was Re: [Rails] Re: How to filter find(:all)]
Hey. I don''t want to hijack the original thread so I''m budding this off. Can someone explain to me why the numbers in the Benchmarker never seem to add up right? How does that second Benchmark add up to 0.233105 when all the previous numbers were 0.000000!? This has puzzled me for a long time but I''ve never thought to ask about it before now. Thanks, RSL On 3/16/07, Chris Hall <christopher.k.hall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''d say the performance hit is negligible > > >> PartSearch.count > => 99588 > >> puts Benchmark.measure { PartSearch.find_all_by_part(''lm311'') } > 0.033333 0.000000 0.033333 ( 0.296591) > => nil > >> puts Benchmark.measure { PartSearch.find(:all, :conditions => > ["part = ?", "lm311"]) } > 0.000000 0.000000 0.000000 ( 0.233105) > => nil > >> puts Benchmark.measure { PartSearch.find(:all, :conditions => "part > = ''lm311''") } > 0.000000 0.000000 0.000000 ( 0.348846) > => nil > > > > On 3/15/07, Steven Albarracin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > I would go with the method approach (using find_by_sql or find), as > > dynamic finders will cost you performance wise > > > > ex. > > > > def find_active_posts > > find(all, :conditions => [''trashed = 0'']) > > end > > > > def find_trashed > > find(all, :conditions => [''trashed = 1'']) > > end > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---