mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 03:10:39 -07:00
make theme_runner actually useful outside of the performance benchmarks
This commit is contained in:
@@ -3,7 +3,13 @@
|
||||
require 'benchmark/ips'
|
||||
require_relative 'theme_runner'
|
||||
|
||||
RubyVM::YJIT.enable if defined?(RubyVM::YJIT)
|
||||
if defined?(RubyVM::YJIT)
|
||||
RubyVM::YJIT.enable
|
||||
puts "* YJIT enabled"
|
||||
else
|
||||
puts "* YJIT not enabled"
|
||||
end
|
||||
|
||||
Liquid::Environment.default.error_mode = ARGV.first.to_sym if ARGV.first
|
||||
|
||||
profiler = ThemeRunner.new
|
||||
@@ -18,8 +24,8 @@ Benchmark.ips do |x|
|
||||
|
||||
phase = ENV["PHASE"] || "all"
|
||||
|
||||
x.report("tokenize:") { profiler.tokenize } if phase == "all" || phase == "tokenize"
|
||||
x.report("parse:") { profiler.compile } if phase == "all" || phase == "parse"
|
||||
x.report("render:") { profiler.render } if phase == "all" || phase == "render"
|
||||
x.report("parse & render:") { profiler.run } if phase == "all" || phase == "run"
|
||||
x.report("tokenize:") { profiler.tokenize_all } if phase == "all" || phase == "tokenize"
|
||||
x.report("parse:") { profiler.compile_all } if phase == "all" || phase == "parse"
|
||||
x.report("render:") { profiler.render_all } if phase == "all" || phase == "render"
|
||||
x.report("parse & render:") { profiler.run_all } if phase == "all" || phase == "run"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user