-
-
Save acook/9058072 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
factorygirl* | |
new* | |
Gemfile.lock |
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
factory_girl_benchmarks |
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
ruby-2.0.0-p353@rubytesting |
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
#!/usr/bin/ruby | |
require 'factory_girl' | |
require 'perftools' | |
require 'benchmark' | |
class SomeObject; end | |
FactoryGirl.define do | |
factory :some_object do | |
end | |
end | |
TIMES = 100_000 | |
Benchmark.bm do |bm| | |
bm.report 'FactoryGirl.build' do | |
PerfTools::CpuProfiler.start("factorygirl") do | |
TIMES.times { FactoryGirl.build :some_object } | |
end | |
end | |
bm.report 'new' do | |
PerfTools::CpuProfiler.start("new") do | |
TIMES.times { SomeObject.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
source 'https://rubygems.org' | |
gem 'perftools.rb' | |
gem 'factory_girl' | |
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
user system total real | |
FactoryGirl.buildPROFILE: interrupts/evictions/bytes = 633/0/32944 | |
6.850000 0.010000 6.860000 ( 6.865386) | |
newPROFILE: interrupts/evictions/bytes = 2/0/168 | |
0.030000 0.010000 0.040000 ( 0.029475) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment