Add `bundle profile` CLI command. #2080

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
7 participants

This command loads all dependencies and dumps their
load time to STDOUT. It takes an optional list of
groups to be loaded in addition to the default group.

Example output:

$ bundle profile
       151ms rails
        16ms pg
       197ms haml
         1ms haml-rails
         3ms jquery-rails
         3ms bcrypt-ruby (LoadError)
        21ms sorcery
         1ms andand
        60ms resque
       108ms heroku
        41ms unicorn
       193ms newrelic_rpm
        90ms rest-client
        82ms jbuilder
        32ms dalli
        21ms thin
       254ms roadie
        31ms rack-mini-profiler
       465ms resque_mail_queue
      1778ms Total time to require all gems
Add `bundle profile` CLI command.
This command loads all dependencies and dumps their
load time to STDOUT. It takes an optional list of
groups to be loaded in addition to the default group.

👍

doriath commented Sep 15, 2012

👍

nirvdrum commented Oct 3, 2012

This would be nice. Even better would be indenting dependencies. So, e.g., if i haml-rails loads haml, haml would should up beneath haml-rails and indented a bit. This way the true cost of loading a particular library is more evident.

Owner

indirect commented Oct 3, 2012

You can get that information by looking at the Gemfile.lock, where the indentation is exactly like that... It sounds like it would be nice for the profile command, though.

On Oct 3, 2012, at 5:32 AM, Kevin Menard notifications@github.com wrote:

This would be nice. Even better would be indenting dependencies. So, e.g., if i haml-rails loads haml, haml would should up beneath haml-rails and indented a bit. This way the true cost of loading a particular library is more evident.


Reply to this email directly or view it on GitHub.

nirvdrum commented Oct 3, 2012

Right. I wanted there to be some parity and save myself from having to cross-reference.

@@ -4,6 +4,12 @@ module Bundler
class Runtime < Environment
include SharedHelpers
+ attr_writer :profiling
+
+ def profiling
@BMorearty

BMorearty Oct 3, 2012

I suppose I should have named this profiling? with a question mark.

Interesting idea (indentation). The way I wrote the pull request, I think it only shows the names of gems that are explicitly stated in the Gemfile...not the dependencies. (Correct me if I'm wrong--this was my first foray into the Bundler code.) It does seem like showing dependencies, and indenting them, could be useful if you're trying to dive deep into figuring out what's causing your bundle to load so slowly.

Perhaps that could be a subsequent pull request from someone who understands how and where dependencies are loaded--whether they're loaded from a Gemfile or a gemspec.

Has this been pretty much abandoned? I'm looking for a feature like this and I've already started coding one, but might dump it and use this as a starting point.

There were a lot of 👍 comments but also someone suggested adding indentation. I don't plan to add indentation to this pull request, so I would ask that either the PR be pulled or closed (rejected) to clean the slate a bit.

cwoodcox added a commit to cwoodcox/bundler that referenced this pull request Apr 23, 2013

Merge remote-tracking branch 'BMorearty/bundle-profile-cli' into bund…
…le-profiling

start with bundler/bundler#2080 and work from there

Conflicts:
	lib/bundler/cli.rb
	lib/bundler/runtime.rb
	man/bundle.ronn

cromulus commented May 1, 2013

👍

Owner

indirect commented May 13, 2013

I think this is a good candidate for a separate tool, rather than being part of Bundler. Until Bundler supports plugins, a separate command (bundle-profile?) seems like the way to go. Thanks!

@indirect indirect closed this May 13, 2013

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