Bug #13111
closedDegraded performance for delegated methods through Forwardable module
Description
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
.
Updated by gonzedge (Edgar Gonzalez) over 7 years ago
Update:
I talked to @Yuki (Yuki Admiral) 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?
Updated by shyouhei (Shyouhei Urabe) over 7 years ago
- Status changed from Open to Closed
- Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: REQUIRED
Let me close (closed issues are inspected by branch mentors to backport-ability). I guess this is a subject to backport.
Updated by naruse (Yui NARUSE) over 7 years ago
- Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: REQUIRED to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE
ruby_2_4 r57913 merged revision(s) 57255,57256,57257.