mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 03:10:39 -07:00
fast-path variable_lookups: skip mutable string alloc when no dot/bracket follows
This commit is contained in:
@@ -83,6 +83,9 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def variable_lookups
|
def variable_lookups
|
||||||
|
# Fast path: no lookups at all (most common case for simple identifiers)
|
||||||
|
return "" unless look(:dot) || look(:open_square)
|
||||||
|
|
||||||
str = +""
|
str = +""
|
||||||
loop do
|
loop do
|
||||||
if look(:open_square)
|
if look(:open_square)
|
||||||
|
|||||||
Reference in New Issue
Block a user