Create a gist now

Instantly share code, notes, and snippets.

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