From f8b015646aa96246b0df4dbdb4d1c53b21ee6351 Mon Sep 17 00:00:00 2001 From: Tobi Lutke Date: Wed, 11 Mar 2026 07:33:18 -0400 Subject: [PATCH] fast-path render for filter-less variables: skip render method overhead --- lib/liquid/variable.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/liquid/variable.rb b/lib/liquid/variable.rb index cd7607a3..dfa51428 100644 --- a/lib/liquid/variable.rb +++ b/lib/liquid/variable.rb @@ -188,7 +188,12 @@ module Liquid end def render_to_output_buffer(context, output) - obj = render(context) + # Fast path: no filters and no global filter + if @filters.empty? && context.global_filter.nil? + obj = context.evaluate(@name) + else + obj = render(context) + end render_obj_to_output(obj, output) output end