Project

General

Profile

Actions

Feature #17288

open

Optimize __send__ call with a literal method name

Added by mrkn (Kenta Murata) about 4 years ago. Updated 8 months ago.

Status:
Assigned
Target version:
-
[ruby-core:100597]

Description

I made a patch to optimize a __send__ call with a literal method name. This optimization replaces a __send__ method call with a send instruction. The patch is available in this pull-request.

By this change, the redefined __send__ method is no longer called when it is called by a literal method name. I guess it is no problem because the following warning message is displayed for a long time.

$ ruby -e 'def __send__; end'
-e:1: warning: redefining `__send__' may cause serious problems

This change makes the optimized case x5~x6 faster. The benchmark result is below:

$ make benchmark COMPARE_RUBY="../../ruby/build-o3/ruby" ITEM=vm_send.yml
(snip)
# Iteration per second (i/s)

|             |compare-ruby|built-ruby|
|:------------|-----------:|---------:|
|vm_send      |     18.536M|  113.778M|
|             |           -|     6.14x|
|vm_send_var  |     18.085M|   16.595M|
|             |       1.09x|         -|

Related issues 1 (1 open0 closed)

Is duplicate of Ruby master - Feature #17291: Optimize __send__ callAssignedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0