Hello everyone,
This email is about Marcin Raczkowski's project for Ruby Summer Of Code (Ruby Summer of Code): Project #12: ActiveRecord Identity Map
You can find the current implementation in my Rails repo (identity_map branch): http://github.com/miloops/rails/commits/identity_map
I was assigned as the mentor project and I've also invested time working on it, since I find its very important for all of us using Rails to have this implemented.
Several days ago, and after lots of feedback, I sent a pull request to rails/master as José Valim suggested: http://github.com/rails/rails/pull/76
Some key features that were lately implemented:
- A middleware that wraps each request into a new map, if it's disabled then no middleware is loaded. - IM is enabled by default: to disable it use config.active_record.identity_map = false - IM is flushed on tests setup, this was added to ActiveSupport::TestCase, if you are using Rspec, you should try with:
before(:each) do ActiveRecord::IdentityMap.clear end
- A WeakHash implementation was included in ActiveSupport, if you are using jRuby Weakling library will be used as WeakHash.
I've been using a script to test resources, which is the most important feature that IM will bring among objects consistency, although speed has increased in some cases is not the goal of IM.
Results from the script are very promising:
I would love to get more feedback, if you try it feel free to comment on the pull request, reply this email, or contact me by email or IM at miloops at gmail.
Thanks!