zombocom/derailed_benchmarks

`rails/all` reported when my app is using specific gems

Closed this issue · 2 comments

It looks like bin/derailed#bundler_setup! is loading the parts of rails it believe it should be using instead of those specified in by application.rb.

  1. This seems to give inaccurate reporting when using bundle:mem by including things like active_mailbox which are not actually loaded with our rails app.

  2. Many other tasks fail as Sprockets complains about a missing manifest file which is correct since we're using webpacker instead of sprockets.

Is there anyway to use the requires from application.rb?

The command

$ derailed bundle:mem

Does not load your application on purpose. The idea is that it is a snapshot of your Gems and can be used even if derailed is unable to boot your app.

If you want to profile your app memory instead of just your bundler memory you need to run

$ derailed exec perf:mem

From here: https://github.com/schneems/derailed_benchmarks#memory-is-large-at-boot it boots application.rb: https://github.com/schneems/derailed_benchmarks/blob/main/lib/derailed_benchmarks/load_tasks.rb#L21

@schneems Well I'm specifically talking about the fact that bin/derailed line 86 requires rails/all which is not actually required by either bundler or my app. The derailed script is assuming that rails/all should be required. Unfortunately in Rails 6 that means that active_mailbox will always show at the top of the list with some massive memory bloat, when on neither bundler nor my app would actually require active_mailbox.