Skip to content

Instantly share code, notes, and snippets.

@solnic
Created December 4, 2012 12:57
Show Gist options
  • Save solnic/4203569 to your computer and use it in GitHub Desktop.
Save solnic/4203569 to your computer and use it in GitHub Desktop.
dm1 vs dm2 - eager loading association
1.9.3p327 :011 > Benchmark.bm { |x| x.report { User.all.each { |u| u.city } } }
user system total real
4.320000 0.010000 4.330000 ( 4.344362)
1.9.3p327 :004 > Benchmark.bm { |x| x.report { DataMapper[User].include(:city).each { |u| u.city } } }
user system total real
2.090000 0.010000 2.100000 ( 2.135567)
@pietia
Copy link

pietia commented Dec 4, 2012

City eagerly loaded in the first case ?

@solnic
Copy link
Author

solnic commented Dec 4, 2012

@pietia yeah SEL should kick in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment