Good morning all, I am wondering if there is any ongoing work to speed up ActiveRecord object instantiation from the database? I am working on a project where we have determined that loading AR records from the database has become a bottleneck in a coupe of spots. To alleviate this we have resorted to raw SQL and hashes. After reading this article (http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), it seems to me that if we made the lifecycle hooks optional we could get a little speed bump. They would be on by default but I could turn them off when I declared my AR derived class. Any other places that I can help out to make this happen? Thanks, Mike -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/vBuB-j6nFM4J. 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.
+1 I don''t have too much experience with the AR''s internals, but this make sense and is interesting. If we could choose to turn off the hooks, the model will has better perfomance and spend time on initialization with only what we choose. -- Carlos Eduardo L. Lopes On 17/08/2012, at 09:41, MikeGehard <mike.gehard@gmail.com> wrote:> Good morning all, > > I am wondering if there is any ongoing work to speed up ActiveRecord object instantiation from the database? I am working on a project where we have determined that loading AR records from the database has become a bottleneck in a coupe of spots. To alleviate this we have resorted to raw SQL and hashes. > > After reading this article (http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), it seems to me that if we made the lifecycle hooks optional we could get a little speed bump. They would be on by default but I could turn them off when I declared my AR derived class. > > Any other places that I can help out to make this happen? > > Thanks, > Mike > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/vBuB-j6nFM4J. > 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.-- 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.
I''ve had great success with the valium and activerecord-import gems, when it comes to a few places where I need to speed things up because I have hundreds or even many thousands of database rows that need processing and when it just so happens that in those cases I don''t need full blown AR objects, just an array of a column or two will do just fine... Dave On Friday, August 17, 2012 5:41:04 AM UTC-7, MikeGehard wrote:> > Good morning all, > > I am wondering if there is any ongoing work to speed up ActiveRecord > object instantiation from the database? I am working on a project where we > have determined that loading AR records from the database has become a > bottleneck in a coupe of spots. To alleviate this we have resorted to raw > SQL and hashes. > > After reading this article ( > http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), > it seems to me that if we made the lifecycle hooks optional we could get a > little speed bump. They would be on by default but I could turn them off > when I declared my AR derived class. > > Any other places that I can help out to make this happen? > > Thanks, > Mike >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/_bUBlO1xcNEJ. 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.
I''ve fixed both issues mentioned in this blog post. If there is any other ideas how we could improve it - please explain them here. On Friday, August 17, 2012 3:41:04 PM UTC+3, MikeGehard wrote:> > Good morning all, > > I am wondering if there is any ongoing work to speed up ActiveRecord > object instantiation from the database? I am working on a project where we > have determined that loading AR records from the database has become a > bottleneck in a coupe of spots. To alleviate this we have resorted to raw > SQL and hashes. > > After reading this article ( > http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), > it seems to me that if we made the lifecycle hooks optional we could get a > little speed bump. They would be on by default but I could turn them off > when I declared my AR derived class. > > Any other places that I can help out to make this happen? > > Thanks, > Mike >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/tAxEWBvmcLEJ. 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.
Are these fixes in master or have they already been released in a 3.x version? On Wednesday, August 22, 2012 3:57:56 AM UTC-6, Bogdan Gusiev wrote:> > I''ve fixed both issues mentioned in this blog post. > If there is any other ideas how we could improve it - please explain them > here. > > On Friday, August 17, 2012 3:41:04 PM UTC+3, MikeGehard wrote: >> >> Good morning all, >> >> I am wondering if there is any ongoing work to speed up ActiveRecord >> object instantiation from the database? I am working on a project where we >> have determined that loading AR records from the database has become a >> bottleneck in a coupe of spots. To alleviate this we have resorted to raw >> SQL and hashes. >> >> After reading this article ( >> http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), >> it seems to me that if we made the lifecycle hooks optional we could get a >> little speed bump. They would be on by default but I could turn them off >> when I declared my AR derived class. >> >> Any other places that I can help out to make this happen? >> >> Thanks, >> Mike >> >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/tkXzjAyVPDgJ. 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.
Hi all, We have extracted our ActiveRecord object instantiation code as a pull request here: https://github.com/rails/rails/pull/7457 Please take a look and see if this would help you with detecting slow instantiations. Thanks, Joe & Jason Frey On Friday, August 17, 2012 8:41:04 AM UTC-4, MikeGehard wrote:> > Good morning all, > > I am wondering if there is any ongoing work to speed up ActiveRecord > object instantiation from the database? I am working on a project where we > have determined that loading AR records from the database has become a > bottleneck in a coupe of spots. To alleviate this we have resorted to raw > SQL and hashes. > > After reading this article ( > http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/), > it seems to me that if we made the lifecycle hooks optional we could get a > little speed bump. They would be on by default but I could turn them off > when I declared my AR derived class. > > Any other places that I can help out to make this happen? > > Thanks, > Mike >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/_aIb6O41U9YJ. 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.
Mike, probably not in 3.x 2012/8/24 MikeGehard <mike.gehard@gmail.com>> Are these fixes in master or have they already been released in a 3.x > version? > > > On Wednesday, August 22, 2012 3:57:56 AM UTC-6, Bogdan Gusiev wrote: >> >> I''ve fixed both issues mentioned in this blog post. >> If there is any other ideas how we could improve it - please explain them >> here. >> >> On Friday, August 17, 2012 3:41:04 PM UTC+3, MikeGehard wrote: >>> >>> Good morning all, >>> >>> I am wondering if there is any ongoing work to speed up ActiveRecord >>> object instantiation from the database? I am working on a project where we >>> have determined that loading AR records from the database has become a >>> bottleneck in a coupe of spots. To alleviate this we have resorted to raw >>> SQL and hashes. >>> >>> After reading this article (http://merbist.com/2012/02/** >>> 23/quick-dive-into-ruby-orm-**object-initialization/<http://merbist.com/2012/02/23/quick-dive-into-ruby-orm-object-initialization/>), >>> it seems to me that if we made the lifecycle hooks optional we could get a >>> little speed bump. They would be on by default but I could turn them off >>> when I declared my AR derived class. >>> >>> Any other places that I can help out to make this happen? >>> >>> Thanks, >>> Mike >>> >> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/tkXzjAyVPDgJ. > > 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. >-- Bogdan Gusiev. agresso@gmail.com -- 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.