make theme_runner actually useful outside of the performance benchmarks

This commit is contained in:
Tobi Lutke
2025-07-29 17:32:31 -04:00
parent 9bb7fbf123
commit 1b1a40c606
2 changed files with 76 additions and 63 deletions
+11 -5
View File
@@ -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