summaryrefslogtreecommitdiff
path: root/version.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-22 00:21:41 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-22 00:21:41 +0000
commit79ddbe9deebc5af0f08e52cd056f58b49e486ea6 (patch)
tree23a3fe79a73cd628579e8a8d4e97829d7e80cc67 /version.h
parent0f63d961169989a7f6dcf7c0487fe29da178a4d2 (diff)
optimize method dispatch for lead/kw params.
similar idea to r67315, provide the following optimization for method dispatch with lead and kw parameters. (1) add a special branch to check passing kw arguments to a method which has lead and kw parameters. ex) def foo(x, k:1); end; foo(0, k:1) (2) add a special branch to check passing no-kw arguments to a method which has lead and kw parameters. ex) def foo(x, k:1); end; foo(0) For (1) and (2) cases, provide special dispatchers. For (2) case, this patch only use the special dispatcher if all default kw parameters are literal values (nil, 1, and so on. In other case, kw->default_values does not contains Qundef) (and no required kw parameters becaseu they don't pass any keyword parameters). Passing keyword arguments with a hash object is not a scope of this patch. Without this patch, (1) and (2) cases use `setup_parameters_complex()`. Especially, (2) seems frequent case for methods which extend a normal usecase with keyword parameters (like: `exception: true`). We can measure the performance with benchmark-driver: With methods: def kw k1:1, k2:2; end def m; end With the following binaries: clean-miniruby: unmodified trunk. opt_miniruby1: use special branches for lead/kw parameters. opt_miniruby2: use special dispatchers for lead/kw parameters. opt_cc_miniruby: apply step (2). Result with benchmark-driver: m opt_miniruby2: 75222278.0 i/s clean-miniruby: 73177896.5 i/s - 1.03x slower opt_miniruby1: 62466783.3 i/s - 1.20x slower kw opt_miniruby2: 52044504.4 i/s opt_miniruby1: 29142025.7 i/s - 1.79x slower clean-miniruby: 20515235.4 i/s - 2.54x slower kw k1: 10 opt_miniruby2: 26492219.5 i/s opt_miniruby1: 25409484.9 i/s - 1.04x slower clean-miniruby: 20235113.7 i/s - 1.31x slower kw k1: 10, k2: 20 opt_miniruby1: 24159534.0 i/s opt_miniruby2: 23470527.5 i/s - 1.03x slower clean-miniruby: 17822621.5 i/s - 1.36x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'version.h')
0 files changed, 0 insertions, 0 deletions