I’ve been experimenting with MongoDB’s map-reduce, called from Ruby, as a replacement for Ruby’s Enumerable methods (map/collect, inject). It’s faster. Much faster.
Next, the details but first – the disclaimers:
- My database is not optimised (using, e.g. indices)
- My non-map/reduce code is not optimised; I’m sure there are better ways to perform database queries and use Enumerable than those in this post
- My map/reduce code is not optimised – these are my first attempts
In short nothing is optimised, my code is probably awful and I’m making it up as I go along. Here we go then!
The Mongoid models
A couple of posts ago, I outlined a Rails application to store feeds and entries from FriendFeed. Here are the models, with fields and methods removed to show just the relations:
Fetching entries by date for a feed
These models make it easy to fetch entries per feed in the…
View original post 532 more words