Skip context.evaluate for String lookup keys in VariableLookup — avoids respond_to? dispatch\n\nResult: {"status":"keep","combined_µs":4103,"parse_µs":2881,"render_µs":1222,"allocations":24881}

This commit is contained in:
Tobi Lutke
2026-04-04 17:42:33 -07:00
committed by Chris Pak
parent a206932c4a
commit 68d697d1c5
+2 -1
View File
@@ -170,7 +170,8 @@ module Liquid
object = context.find_variable(name)
@lookups.each_index do |i|
key = context.evaluate(@lookups[i])
lookup = @lookups[i]
key = lookup.instance_of?(String) ? lookup : context.evaluate(lookup)
# Cast "key" to its liquid value to enable it to act as a primitive value
# Fast path: strings and integers (most common key types) don't need conversion