mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Avoid expr_markup byteslice when name is entire markup string (no whitespace, no filters)\n\nResult: {"status":"keep","combined_µs":4277,"parse_µs":3057,"render_µs":1220,"allocations":27026}
This commit is contained in:
@@ -151,8 +151,12 @@ module Liquid
|
||||
pos += 1
|
||||
end
|
||||
|
||||
# Resolve the name expression
|
||||
expr_markup = markup.byteslice(name_start, name_end - name_start)
|
||||
# Resolve the name expression — avoid byteslice when markup is already the name
|
||||
expr_markup = if name_start == 0 && name_end == len
|
||||
markup # no whitespace, no filters — reuse the string
|
||||
else
|
||||
markup.byteslice(name_start, name_end - name_start)
|
||||
end
|
||||
cache = parse_context.expression_cache
|
||||
ss = parse_context.string_scanner
|
||||
|
||||
|
||||
Reference in New Issue
Block a user