Created
November 2, 2010 17:20
-
-
Save jraines/659961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#testing the speed of creating a new object via the association with mongoid | |
c = Club.first | |
####### 43 seconds ####### | |
begin | |
500.times do |i| | |
c.people.create(:name => 'Jim') | |
end | |
end | |
####### 1 second ######### | |
begin | |
club_id = c._id | |
500.times do |i| | |
Person.create(:name => 'Jim', :club_id => club_id) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is there such a performance difference?