Skip to content

Instantly share code, notes, and snippets.

@joeyAghion
Created December 8, 2011 23:11
Show Gist options
  • Save joeyAghion/1449172 to your computer and use it in GitHub Desktop.
Save joeyAghion/1449172 to your computer and use it in GitHub Desktop.
benchmark of .where(:_id.in => [...]) vs. multiple .find MongoDB/Mongoid queries
$ bex rails benchmarker 1000 "Artwork.where(:_id.in => [<...100 doc ids...>]).map(&:title)" "[<...100 doc ids...>].map{|id| Artwork.find(id) }.map(&:title)"
user system total real
#1 112.410000 1.470000 113.880000 (116.483996)
#2 151.740000 4.310000 156.050000 (166.557997)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment