mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 02:10:41 -07:00
Benchmark marshal load and render against parse and render.
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
require 'benchmark/ips'
|
||||
require 'benchmark'
|
||||
require File.dirname(__FILE__) + '/theme_runner'
|
||||
|
||||
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
|
||||
profiler = ThemeRunner.new
|
||||
|
||||
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 }
|
||||
N = 100
|
||||
Benchmark.bmbm do |x|
|
||||
x.report("parse:") { N.times { profiler.parse } }
|
||||
x.report("marshal load:") { N.times { profiler.marshal_load } }
|
||||
x.report("render:") { N.times { profiler.render } }
|
||||
x.report("marshal load & render:") { N.times { profiler.load_and_render } }
|
||||
x.report("parse & render:") { N.times { profiler.parse_and_render } }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user