Degraded performance for delegated methods through Forwardable module
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
Updated by gonzedge (Edgar Gonzalez) over 3 years ago
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?
Updated by shyouhei (Shyouhei Urabe) over 3 years ago
- Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: REQUIRED
- Status changed from Open to Closed
Let me close (closed issues are inspected by branch mentors to backport-ability). I guess this is a subject to backport.