From ef935705cfb1b4493b8b8cf112e435b554b3138a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 19 May 2025 09:58:14 -0700 Subject: [PATCH] Use shape_id for determining "too complex" Using `rb_shape_obj_too_complex_p` looks up the shape, but we already have the shape id. This avoids looking up the shape twice. --- variable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variable.c b/variable.c index 2f8a606930..62dfe5844e 100644 --- a/variable.c +++ b/variable.c @@ -1423,7 +1423,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef) shape_id = RCLASS_SHAPE_ID(obj); #endif - if (rb_shape_obj_too_complex_p(obj)) { + if (rb_shape_id_too_complex_p(shape_id)) { st_table * iv_table = RCLASS_FIELDS_HASH(obj); if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) { found = true; @@ -1464,7 +1464,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef) #if !SHAPE_IN_BASIC_FLAGS shape_id = ROBJECT_SHAPE_ID(obj); #endif - if (rb_shape_obj_too_complex_p(obj)) { + if (rb_shape_id_too_complex_p(shape_id)) { st_table * iv_table = ROBJECT_FIELDS_HASH(obj); VALUE val; if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {