mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -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
|
||||
|
||||
def variable_lookups
|
||||
# Fast path: no lookups at all (most common case for simple identifiers)
|
||||
return "" unless look(:dot) || look(:open_square)
|
||||
|
||||
str = +""
|
||||
loop do
|
||||
if look(:open_square)
|
||||
|
||||
Reference in New Issue
Block a user