Skip to content

Conversation

@Edouard-chin
Copy link
Contributor

What was the end-user or developer problem that led to this PR?

I'd like to be able to see how long bundler takes for basic operations such as downloading a gem from Rubygems.org and installing a gem.

What is your fix for the problem, implemented in this PR?

Added Gem.time to surrounding code of interest such as during downloading of a gem and installation.

def self.time(msg, width = 0, display = Gem.configuration.verbose)

It will now be possible with this commit by running DEBUG=true bundle install and have output that looks like:

Fetching rack-test 2.2.0
Downloaded rack-test in: 50.523s
Installing rack-test 2.2.0
Installed rack-test in: : 0.003s

Make sure the following tasks are checked

- I'd like to be able to see how long bundler takes for basic
  operations such as downloading a gem from Rubygems.org and
  installing a gem.

  It will now be possible with this commit by running
  `DEBUG=true bundle install` and have output that looks like:

  Fetching rack-test 2.2.0
  Downloaded rack-test in: 50.523s
  Installing rack-test 2.2.0
  Installed rack-test in: : 0.003s
installed_spec = installer.install
installed_spec = nil

Gem.time("Installed #{spec.name} in", 0, true) do
Copy link
Contributor Author

@Edouard-chin Edouard-chin Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting the true at the end. The default being to output only when Gem.configuration.verbose is true. But since we are in the context of Bundler, the the RG UI is overriden and those logs will only appear if the level is set to debug

Bundler.rubygems.ui = UI::RGProxy.new(ui)

@ui&.debug(message)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 Thanks for your explanation. I didn't know that.

@Edouard-chin Edouard-chin changed the title Add debug logging information: Add debug logging information to see the time it took to download and install a gem Nov 10, 2025
@hsbt hsbt merged commit bfffda5 into ruby:master Nov 13, 2025
86 of 88 checks passed
@Edouard-chin
Copy link
Contributor Author

Thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants