Speeding up ActiveRecord

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?




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.

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…


Are these fixes in master or have they already been released in a 3.x version?

Mike, probably not in 3.x