Created
December 13, 2017 10:12
-
-
Save Mehonoshin/9c22d3187815aee03c391bfb2d1e892a to your computer and use it in GitHub Desktop.
Checking how long each gem from Gemfile takes to load
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
require "benchmark" | |
if ENV['TRACE_GEMS'] | |
def require(file_name) | |
result = nil | |
time = Benchmark.realtime do | |
result = super | |
end | |
if time > 0.1 | |
puts "#{time} #{file_name}" | |
end | |
result | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment