fast-path variable_lookups: skip mutable string alloc when no dot/bracket follows

This commit is contained in:
Tobi Lutke
2026-03-11 07:26:40 -04:00
parent c1113ad2f8
commit 1a79cf6266
+3
View File
@@ -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)