Created
July 4, 2012 07:05
-
-
Save matisojka/3045819 to your computer and use it in GitHub Desktop.
Measure Gem loading time in your Rails APP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disclaimer: this solution has been taken from the post: http://stackoverflow.com/a/5071198/784270 | |
# navigate to the bundler gem and in lib/bundler/runtime.rb, | |
# find the line that does Kernel.require and wrap it like this | |
puts Benchmark.measure("require #{file}") { | |
Kernel.require file | |
}.format("%n: %t %r") | |
# Add | |
require 'benchmark' | |
# to config/boot.rb | |
# Start the console / server to see the benchmark. | |
# If you want to measure the total loading time of your Rails app, you can use the solution | |
# proposed in: http://erik.debill.org/2011/02/19/ruby-start-up-times | |
echo puts Time.now > test_script | |
time rails runner test_script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment