summaryrefslogtreecommitdiff
path: root/spec/ruby/core/basicobject/instance_eval_spec.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-20 19:57:39 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-20 19:57:39 +0000
commit24e03d7e268f5b89367d495ee2b4aac0b700e6e1 (patch)
tree7916c47e4d2cdeda91e5ca398abf5064f44d1616 /spec/ruby/core/basicobject/instance_eval_spec.rb
parent139634a16fc5fa6779b08aeb89f40b289579c4bf (diff)
optimize method dispatch for lead/opt params.
There is a special optimization for "only lead parameters" method dispatch using specialized dispatcher functions `vm_call_iseq_setup_normal_0start...`. Other cases (opt, rest, post, ...) we don't use specialized dispatcher and call with `setup_parameters_complex` to satisfy Ruby's complex parameter specification. This commit introduce a specialize dispatcher for methods which use only lead and optional parameters. Two step improvements: (1) prepare "lead/opt" only check pass. It is to skip the `setup_parameters_complex` function. (2) introduce specialized dispatcher for only "lead/opt" parameters methods (vm_call_iseq_setup_normal_opt_start). With these improvements, we achieved good micro-benchmark results: With a method: `def opt2 a, b=nil; end` With the following binaries: clean-miniruby: unmodified trunk. opt_miniruby: apply step (1). opt_cc_miniruby: apply step (2). Result with benchmark-driver: opt2(1) opt_cc_miniruby: 42269409.1 i/s opt_miniruby: 36304428.3 i/s - 1.16x slower clean-miniruby: 25897409.5 i/s - 1.63x slower opt2(1, 2) opt_cc_miniruby: 45935145.7 i/s opt_miniruby: 40513196.9 i/s - 1.13x slower clean-miniruby: 29976057.6 i/s - 1.53x slower This improvement may be trivial (difficult to improve practical cases). However, this is enough small patch so I decide to introduce it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/basicobject/instance_eval_spec.rb')
0 files changed, 0 insertions, 0 deletions