Skip to content

Commit 966dbba

Browse files
committed
Box: skip checking the current box is the root box
Because checking the current box is not a cheap process.
1 parent 27d6c96 commit 966dbba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ class_alloc0(enum ruby_value_type type, VALUE klass, bool boxable)
820820
static VALUE
821821
class_alloc(enum ruby_value_type type, VALUE klass)
822822
{
823-
bool boxable = BOX_ROOT_P(rb_current_box());
823+
bool boxable = rb_box_available() && BOX_ROOT_P(rb_current_box());
824824
return class_alloc0(type, klass, boxable);
825825
}
826826

0 commit comments

Comments
 (0)