mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Add rigid mode to rake benchmark task
The benchmark results show that rigid mode performs a bit better than both strict
and lax modes across most metrics, including tokenization, parsing, rendering,
and their combined operations. Rigid mode consistently delivers the highest
number of iterations per second, with performance differences staying within
1–2% compared to the other modes
```
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb lax
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 332.000 i/100ms
parse: 14.000 i/100ms
render: 61.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.325k (± 1.0%) i/s (300.73 μs/i) - 66.732k in 20.070562s
parse: 148.166 (± 0.7%) i/s (6.75 ms/i) - 2.968k in 20.032971s
render: 654.428 (± 4.0%) i/s (1.53 ms/i) - 13.115k in 20.090452s
parse & render: 116.108 (± 1.7%) i/s (8.61 ms/i) - 2.332k in 20.089221s
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb strict
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 332.000 i/100ms
parse: 14.000 i/100ms
render: 61.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.332k (± 0.2%) i/s (300.14 μs/i) - 66.732k in 20.029095s
parse: 145.674 (± 0.0%) i/s (6.86 ms/i) - 2.926k in 20.086104s
render: 656.711 (± 4.6%) i/s (1.52 ms/i) - 13.115k in 20.050810s
parse & render: 114.705 (± 0.0%) i/s (8.72 ms/i) - 2.299k in 20.043028s
================================================================================
/opt/rubies/3.4.1/bin/ruby ./performance/benchmark.rb rigid
Running benchmark for 20 seconds (with 10 seconds warmup).
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
tokenize: 333.000 i/100ms
parse: 14.000 i/100ms
render: 62.000 i/100ms
parse & render: 11.000 i/100ms
Calculating -------------------------------------
tokenize: 3.334k (± 0.3%) i/s (299.93 μs/i) - 66.933k in 20.075484s
parse: 148.349 (± 2.0%) i/s (6.74 ms/i) - 2.968k in 20.019775s
render: 663.752 (± 2.6%) i/s (1.51 ms/i) - 13.268k in 20.010303s
parse & render: 116.464 (± 2.6%) i/s (8.59 ms/i) - 2.332k in 20.037869s
liquid$
```
This commit is contained in:
committed by
Guilherme Carreiro
parent
6aa4041c0f
commit
15430c0770
@@ -88,8 +88,13 @@ namespace :benchmark do
|
||||
ruby "./performance/benchmark.rb strict"
|
||||
end
|
||||
|
||||
desc "Run the liquid benchmark with both lax and strict parsing"
|
||||
task run: [:lax, :strict]
|
||||
desc "Run the liquid benchmark with rigid parsing"
|
||||
task :rigid do
|
||||
ruby "./performance/benchmark.rb rigid"
|
||||
end
|
||||
|
||||
desc "Run the liquid benchmark with lax, strict, and rigid parsing"
|
||||
task run: [:lax, :strict, :rigid]
|
||||
|
||||
desc "Run unit benchmarks"
|
||||
namespace :unit do
|
||||
|
||||
Reference in New Issue
Block a user