Skip to content

Instantly share code, notes, and snippets.

@sbpipb
Created December 4, 2019 07:38
Show Gist options
  • Save sbpipb/0529beafd8a2d48ab3c0385b3969da89 to your computer and use it in GitHub Desktop.
Save sbpipb/0529beafd8a2d48ab3c0385b3969da89 to your computer and use it in GitHub Desktop.
benchmarking shiz
Benchmark.ips do |bm|
bm.report("spy") { spy(User, id: 1) }
bm.report("double") { double(User, id: 1) }
bm.report("verifying double") { instance_double(User, id: 1) }
bm.report("actual object") { User.new(id: 1) }
bm.report("via factorygirl") { FactoryGirl.build(:user, id: 1) }
bm.compare!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment