Skip to content

Commit b5a8a5e

Browse files
author
Maxime Chevalier-Boisvert
committed
Add new liquid-compile benchmark
1 parent 6fd6459 commit b5a8a5e

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

benchmarks.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ erubi_rails:
1010
hexapdf:
1111
desc: hexapdf benchmarks the hexapdf Ruby gem by line-wrapping The Odyssey with specific line-length and font.
1212
category: headline
13+
liquid-compile:
14+
desc: compiles a chosen-for-profiling Liquid theme repeatedly.
15+
category: headline
1316
liquid-render:
14-
desc: liquid-render renders a chosen-for-profiling Liquid theme repeatedly.
17+
desc: renders a chosen-for-profiling Liquid theme repeatedly.
1518
category: headline
1619
mail:
1720
desc: mail tests the Mail gem by repeatedly creating an email from a text file and converting it to a string for sending.

benchmarks/liquid-compile/Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
git_source(:github) do |repo_name|
5+
"https://github.com/#{repo_name}.git"
6+
end
7+
8+
# Use `gem github:` to also get the performance/ directory
9+
gem "liquid", github: "Shopify/liquid", ref: "v5.4.0"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
GIT
2+
remote: https://github.com/Shopify/liquid.git
3+
revision: 4d4a565e98c1dda099df1fddf80e293f768cda29
4+
ref: v5.4.0
5+
specs:
6+
liquid (5.4.0)
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
12+
PLATFORMS
13+
ruby
14+
x86_64-linux
15+
16+
DEPENDENCIES
17+
liquid!
18+
19+
BUNDLED WITH
20+
2.3.26
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require 'harness'
2+
3+
Dir.chdir __dir__
4+
use_gemfile
5+
6+
require 'liquid'
7+
liquid_lib_dir = $LOAD_PATH.detect { |p| File.exist?(File.join(p, "liquid.rb")) }
8+
require File.join(File.dirname(liquid_lib_dir), "performance/theme_runner")
9+
10+
run_benchmark(150) do
11+
profiler = ThemeRunner.new
12+
profiler.compile
13+
end

benchmarks/liquid-render/benchmark.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
liquid_lib_dir = $LOAD_PATH.detect { |p| File.exist?(File.join(p, "liquid.rb")) }
88
require File.join(File.dirname(liquid_lib_dir), "performance/theme_runner")
99

10-
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
1110
profiler = ThemeRunner.new
12-
1311
profiler.compile
1412

1513
run_benchmark(150) do

0 commit comments

Comments
 (0)