Created
March 9, 2013 02:50
-
-
Save gabetax/5122270 to your computer and use it in GitHub Desktop.
FactoryGirl.build on a PORO with no defined attributes vs #new
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
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 |
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
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