Skip to content

Instantly share code, notes, and snippets.

@jmgarnier
Created September 1, 2010 14:08
Show Gist options
  • Save jmgarnier/560728 to your computer and use it in GitHub Desktop.
Save jmgarnier/560728 to your computer and use it in GitHub Desktop.
require 'benchmark'
$require_level = 0
module Kernel
alias require_without_timing require
def require(path)
result = seconds = nil
begin
$require_level += 1
seconds = Benchmark.realtime { result = require_without_timing(path) }
ensure
$require_level -= 1
end
puts "{'%.5f' % seconds} {' '*$require_level}{path}" if result
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment