mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
Cache block_delimiter strings per tag name — avoids repeated string interpolation\n\nResult: {"status":"keep","combined_µs":4372,"parse_µs":3127,"render_µs":1245,"allocations":25605}
This commit is contained in:
+4
-1
@@ -60,8 +60,11 @@ module Liquid
|
|||||||
@tag_name
|
@tag_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Cache block delimiters per tag name to avoid repeated string allocation
|
||||||
|
BLOCK_DELIMITER_CACHE = Hash.new { |h, k| h[k] = "end#{k}".freeze }
|
||||||
|
|
||||||
def block_delimiter
|
def block_delimiter
|
||||||
@block_delimiter ||= "end#{block_name}"
|
@block_delimiter ||= BLOCK_DELIMITER_CACHE[block_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user