Issue #13111 has been updated by Edgar Gonzalez.


***Update***:

I talked to Yuki Nishijima and he pointed out that it is an issue with an `UnboundMethod` instance being created on every delegated call here: https://github.com/ruby/ruby/blob/2283d14cc9fefa278dfde02bdf8d84ce50cfe16f/lib/forwardable.rb#L207 (thanks, Yuki!)

Also, I saw that the issue has been fixed on the `trunk` branch in revisions 57255, 57256 & 57257 (thanks, Nobuyoshi Nakada!).

So, I'm inclined to ask: Will this fix be ported back to Ruby 2.4? Either way, how soon would a new version with the fix be released?

----------------------------------------
Bug #13111: Degraded performance for delegated methods through Forwardable module
https://bugs.ruby-lang.org/issues/13111#change-62412

* Author: Edgar Gonzalez
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
After upgrading to Ruby 2.4.0 on my local machine while developing some changes on this gem: https://github.com/gonzedge/rambling-trie, there was a noticeable performance degradation with any delegated methods through `Forwardable`. I have a few benchmarks in place and, without changing any other code, had a ~25% increase in the time it took to execute.

If you look at the benchmarks on https://github.com/gonzedge/rambling-trie/blob/master/reports/0.9.2/benchmark and https://github.com/gonzedge/rambling-trie/blob/master/reports/0.9.3/benchmark, you'll notice that the first benchmark (for `Rambling::Trie.create`) goes from 8.97 seconds to 11.19 seconds. These benchmarks are generated by running `rake performance:benchmark:all`.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>