diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-06-01 13:15:43 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-06-01 13:15:43 +0900 |
commit | 65e63af377bb493dea4d0207627ed87d5da360a8 (patch) | |
tree | 06871344ac6e5800a9c06387d52f2ce942c04609 /internal.h | |
parent | 7df65ef67691fcc354d819da9cd54a1ade9b6247 (diff) | |
download | ruby-65e63af377bb493dea4d0207627ed87d5da360a8.tar.gz |
Make opt_aref instruction support Integer#[]
only when its receiver and the argument are both Integers.
Since 6bedbf4625, Integer#[] has supported a range extraction.
This means that Integer#[] now accepts multiple arguments, which made
the method very slow unfortunately.
This change fixes the performance issue by adding a special handling for
its traditional use case: `num[idx]` where both `num` and `idx` are
Integers.
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 4312f8d442..b1e6aec0dd 100644 --- a/internal.h +++ b/internal.h @@ -1737,6 +1737,7 @@ VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode); VALUE rb_int2str(VALUE num, int base); VALUE rb_dbl_hash(double d); VALUE rb_fix_plus(VALUE x, VALUE y); +VALUE rb_fix_aref(VALUE fix, VALUE idx); VALUE rb_int_gt(VALUE x, VALUE y); int rb_float_cmp(VALUE x, VALUE y); VALUE rb_float_gt(VALUE x, VALUE y); |