Permalink
Browse files

update README for benchmark

  • Loading branch information...
1 parent e4bab92 commit ba2a29d1ec7baf20b757fdc1415af0163e18f459 @flyerhzm committed Jan 19, 2011
Showing with 11 additions and 10 deletions.
  1. +1 −1 Gemfile.lock
  2. +10 −9 README.md
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- mongoid-eager-loading (0.1.2)
+ mongoid-eager-loading (0.2.0)
GEM
remote: http://rubygems.org/
View
@@ -18,7 +18,7 @@ suppose you have a mongoid model Post
class Post
include Mongoid::Document
-
+
referenced_in :user
references_many :comments
end
@@ -27,22 +27,23 @@ then you can use the eager loading like
Post.includes(:user)
Post.includes(:user, :comments)
-
+
eager loading can be only used on referenced_in, references_one and references_many associations.
-
+
Benchmark
---------
I also run a [benchmark][1] on my local computer, the result is as follows
Starting benchmark...
user system total real
- Finding 10 posts with person, without eager loading 0.010000 0.000000 0.010000 ( 0.006538)
- Finding 10 posts with person, with eager loading 0.000000 0.000000 0.000000 ( 0.005235)
- Finding 50 posts with person, without eager loading 0.020000 0.000000 0.020000 ( 0.027912)
- Finding 50 posts with person, with eager loading 0.020000 0.000000 0.020000 ( 0.020103)
- Finding 100 posts with person, without eager loading 0.040000 0.000000 0.040000 ( 0.055197)
- Finding 100 posts with person, with eager loading 0.030000 0.010000 0.040000 ( 0.040644)
+ Finding 10 posts with person, without eager loading 0.010000 0.000000 0.010000 ( 0.005121)
+ Finding 10 posts with person, with eager loading 0.000000 0.000000 0.000000 ( 0.001886)
+ Finding 50 posts with person, without eager loading 0.020000 0.000000 0.020000 ( 0.021442)
+ Finding 50 posts with person, with eager loading 0.000000 0.000000 0.000000 ( 0.005267)
+ Finding 100 posts with person, without eager loading 0.050000 0.000000 0.050000 ( 0.057718)
+ Finding 100 posts with person, with eager loading 0.010000 0.000000 0.010000 ( 0.010141)
+
Author
------

0 comments on commit ba2a29d

Please sign in to comment.