From 9b2ff68f17d225aed2ae9e72a51014cbfcaaaff1 Mon Sep 17 00:00:00 2001 From: Satoshi Tagomori Date: Tue, 30 Dec 2025 22:01:54 +0900 Subject: [PATCH] Box: skip checking the current box is the root box Because checking the current box is not a cheap process. --- class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class.c b/class.c index 8c773125e1..9c1bd86dc3 100644 --- a/class.c +++ b/class.c @@ -820,7 +820,7 @@ class_alloc0(enum ruby_value_type type, VALUE klass, bool boxable) static VALUE class_alloc(enum ruby_value_type type, VALUE klass) { - bool boxable = BOX_ROOT_P(rb_current_box()); + bool boxable = rb_box_available() && BOX_ROOT_P(rb_current_box()); return class_alloc0(type, klass, boxable); }