In a microbenchmark for raw tags, this PR introduces a performance impact during parsing.
This branch:
parse 80.202k (± 8.7%) i/s - 400.816k in 5.036587s
render 214.678k (± 6.1%) i/s - 1.081M in 5.055158s
parse & render 48.202k (± 5.8%) i/s - 243.744k in 5.074713s
Master:
parse 105.637k (± 6.9%) i/s - 535.392k in 5.092843s
render 206.248k (± 8.5%) i/s - 1.036M in 5.058648s
parse & render 57.954k (± 6.6%) i/s - 292.464k in 5.069258s
Script:
require "benchmark/ips"
require "liquid"
require "liquid/c"
source = <<~LIQUID
{% raw %}
{% test %}
hello world
{% endtest %}
{% endraw %}
LIQUID
template = Liquid::Template.parse(source)
Benchmark.ips do |x|
x.report("parse") do |times|
times.times do
Liquid::Template.parse(source)
end
end
x.report("render") do |times|
times.times do
template.render!
end
end
x.report("parse & render") do |times|
times.times do
Liquid::Template.parse(source).render!
end
end
end
See Shopify/liquid#1378.
Benchmarks
In a microbenchmark for
raw
tags, this PR introduces a performance impact during parsing.This branch:
Master:
Script: