benchmark/ips

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