mirror of
https://github.com/Shopify/liquid.git
synced 2025-09-06 00:00:14 -04:00
benchmark/ips
This commit is contained in:
parent
79d4ec1a48
commit
a74d40f1e5
1
Gemfile
1
Gemfile
@ -5,4 +5,5 @@ gem 'stackprof', platforms: :mri_21
|
||||
|
||||
group :test do
|
||||
gem 'spy', '0.4.1'
|
||||
gem 'benchmark-ips'
|
||||
end
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user