Skip to content

Commit ef93570

Browse files
committed
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.
1 parent 6df6aaa commit ef93570

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

variable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
14231423
shape_id = RCLASS_SHAPE_ID(obj);
14241424
#endif
14251425

1426-
if (rb_shape_obj_too_complex_p(obj)) {
1426+
if (rb_shape_id_too_complex_p(shape_id)) {
14271427
st_table * iv_table = RCLASS_FIELDS_HASH(obj);
14281428
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {
14291429
found = true;
@@ -1464,7 +1464,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
14641464
#if !SHAPE_IN_BASIC_FLAGS
14651465
shape_id = ROBJECT_SHAPE_ID(obj);
14661466
#endif
1467-
if (rb_shape_obj_too_complex_p(obj)) {
1467+
if (rb_shape_id_too_complex_p(shape_id)) {
14681468
st_table * iv_table = ROBJECT_FIELDS_HASH(obj);
14691469
VALUE val;
14701470
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {

0 commit comments

Comments
 (0)