From 128b4e35becbd0098602c1c4cf4893286de03f3e Mon Sep 17 00:00:00 2001 From: Jemma Issroff Date: Thu, 12 Jan 2023 15:35:22 -0500 Subject: [PATCH] Initialize context to nil on the Drop class We believe this will reduce megamorphic exits in YJIT. There are currently 241 separate shapes generated with edge_name "@context" in SFR. Initializing it to nil will significantly reduce this number. --- lib/liquid/drop.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index d4d8950f..b990630e 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -25,6 +25,10 @@ module Liquid class Drop attr_writer :context + def initialize + @context = nil + end + # Catch all for the method def liquid_method_missing(method) return nil unless @context&.strict_variables