mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Improve performance of type conversion using to_r
* object.c: Add to_r in conv_method_tbl. * defs/id.def: add to_r. * benchmark/bm_int_quo.rb: added. * benchmark/bm_time_subsec.rb: added. [Bug #13426] [ruby-core:80665] [Fix GH-1582] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3c547e1129
commit
8561baf340
4 changed files with 5 additions and 0 deletions
1
benchmark/bm_int_quo.rb
Normal file
1
benchmark/bm_int_quo.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
5000000.times { 42.quo(3) }
|
2
benchmark/bm_time_subsec.rb
Normal file
2
benchmark/bm_time_subsec.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
t = Time.now
|
||||||
|
4000000.times { t.subsec }
|
|
@ -38,6 +38,7 @@ firstline, predefined = __LINE__+1, %[\
|
||||||
to_a
|
to_a
|
||||||
to_s
|
to_s
|
||||||
to_i
|
to_i
|
||||||
|
to_r
|
||||||
bt
|
bt
|
||||||
bt_locations
|
bt_locations
|
||||||
call
|
call
|
||||||
|
|
1
object.c
1
object.c
|
@ -2619,6 +2619,7 @@ static const struct conv_method_tbl {
|
||||||
M(a),
|
M(a),
|
||||||
M(s),
|
M(s),
|
||||||
M(i),
|
M(i),
|
||||||
|
M(r),
|
||||||
#undef M
|
#undef M
|
||||||
};
|
};
|
||||||
#define IMPLICIT_CONVERSIONS 7
|
#define IMPLICIT_CONVERSIONS 7
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue