mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
Perf: Remove unneeded to_s and freeze strings
- No longer call to_s on string literals passed to undefined filters - Freeze all string literals at the top of the generated code This shows a ~9% performance improvement on the fluid benchmark when run without YJIT
This commit is contained in:
@@ -18,14 +18,6 @@ Liquid::Template.register_filter(ShopFilter)
|
||||
|
||||
context = Liquid::Context.new([tables, {}], {}, {}, false, Liquid::ResourceLimits.new(Liquid::Template.default_resource_limits))
|
||||
|
||||
require 'stackprof'
|
||||
|
||||
results = StackProf.run(raw: true, out: 'stackprof.dump') do
|
||||
500_000.times do
|
||||
@template.render(context)
|
||||
end
|
||||
end
|
||||
|
||||
Benchmark.ips do |x|
|
||||
x.report("render") { @template.render(context) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user