Bundler::DepProxy#name performance improvement.#5536
Bundler::DepProxy#name performance improvement.#5536technicalpickles wants to merge 1 commit intoruby:masterfrom
Conversation
Looking over flamegraphs for `require 'bundler/setup'`, I'm seeing `Bundler::DepProxy#name` show up quite often. The method itself is really simple, delegating to the dependency's proxy. I suspect it is getting called enough that memoizing the value improves will improve performance by saving a method call, in exchange for saving the value in memory. When testing with this patch plus ruby#5533 I saw time go from 0.92s to 0.75s.
|
Can you provide a repro script that others can use to verify/see the performance improvements? Ideally using a benchmarking tool like |
|
This is really awesome! Funny enough, yesterday I was working on making |
|
I kept exploring the idea of not using So my understanding is that #5537 makes this PR unnecessary but I'd like @technicalpickles to confirm! |
I will work on it, yes! I think the main thing is getting a sufficiently large Gemfile (
I'll test to confirm, the flamegraph should tell us if it's still frequently in the stack. |
|
After all the other improvements made, this PR seems to no longer speed up things, so I guess we can close it! Thanks @technicalpickles! |
What was the end-user or developer problem that led to this PR?
Looking for ways to speed up
require 'bundler/setup'What is your fix for the problem, implemented in this PR?
Looking over flamegraphs for
require 'bundler/setup', I'm seeingBundler::DepProxy#nameshow up quite often. The method itself is reallysimple, delegating to the dependency's proxy. It's taking up to 1ms sometimes.
I suspect it is getting called enough that memoizing the value improves
will improve performance by saving a method call, in exchange for saving
the value in memory.
When testing with this patch plus #5533
I saw time go from 0.92s to 0.75s.
Make sure the following tasks are checked