Merge pull request #402 from Shopify/benchmark-ips

benchmark/ips
This commit is contained in:
Florian Weingarten
2014-08-11 21:22:43 +02:00
2 changed files with 12 additions and 5 deletions
+1
View File
@@ -5,4 +5,5 @@ gem 'stackprof', platforms: :mri_21
group :test do
gem 'spy', '0.4.1'
gem 'benchmark-ips'
end
+11 -5
View File
@@ -1,11 +1,17 @@
require 'benchmark'
require 'benchmark/ips'
require File.dirname(__FILE__) + '/theme_runner'
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
profiler = ThemeRunner.new
Benchmark.bmbm do |x|
x.report("parse:") { 100.times { profiler.compile } }
x.report("parse & run:") { 100.times { profiler.run } }
end
Benchmark.ips do |x|
x.time = 60
x.warmup = 5
puts
puts "Running benchmark for #{x.time} seconds (with #{x.warmup} seconds warmup)."
puts
x.report("parse:") { profiler.compile }
x.report("parse & run:") { profiler.run }
end