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

This commit is contained in:
Tobi Lutke
2026-04-04 17:33:53 -07:00
committed by Chris Pak
parent e73b41f3b6
commit a404cf10d0
+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)