Skip to content

Instantly share code, notes, and snippets.

@RafeHatfield
Forked from gabetax/benchmark.rb
Created July 25, 2014 22:52
Show Gist options
  • Save RafeHatfield/4d01560b20ebb1743219 to your computer and use it in GitHub Desktop.
Save RafeHatfield/4d01560b20ebb1743219 to your computer and use it in GitHub Desktop.
require 'perftools'
TIMES = 100_000
Benchmark.bm do |bm|
bm.report 'FactoryGirl.build' do
PerfTools::CpuProfiler.start("factorygirl") do
TIMES.times { FactoryGirl.build :loans_search_form }
end
end
bm.report 'new' do
PerfTools::CpuProfiler.start("new") do
TIMES.times { LoansSearchForm.new }
end
end
end
FactoryGirl.define do
factory :loans_search_form do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment