ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:100597] [Ruby master Feature#17288] Optimize __send__ call with a literal method name
@ 2020-10-27  8:32 muraken
  2020-10-27 18:35 ` [ruby-core:100610] " eregontp
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: muraken @ 2020-10-27  8:32 UTC (permalink / raw)
  To: ruby-core

Issue #17288 has been reported by mrkn (Kenta Murata).

----------------------------------------
Feature #17288: Optimize __send__ call with a literal method name
https://bugs.ruby-lang.org/issues/17288

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
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](https://github.com/ruby/ruby/pull/3707).

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|         -|
```



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-10-30  0:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27  8:32 [ruby-core:100597] [Ruby master Feature#17288] Optimize __send__ call with a literal method name muraken
2020-10-27 18:35 ` [ruby-core:100610] " eregontp
2020-10-28  8:25 ` [ruby-core:100616] " shyouhei
2020-10-28  8:34 ` [ruby-core:100617] " zverok.offline
2020-10-28  9:58 ` [ruby-core:100618] " shyouhei
2020-10-28 10:09 ` [ruby-core:100619] " eregontp
2020-10-28 12:32 ` [ruby-core:100621] " shyouhei
2020-10-28 20:48 ` [ruby-core:100624] " marcandre-ruby-core
2020-10-28 20:59 ` [ruby-core:100625] " shevegen
2020-10-29  0:11 ` [ruby-core:100628] " shyouhei
2020-10-29  4:06 ` [ruby-core:100632] " marcandre-ruby-core
2020-10-29 20:12 ` [ruby-core:100660] " eregontp
2020-10-30  0:17 ` [ruby-core:100663] " shyouhei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).