Skip to content

Instantly share code, notes, and snippets.

@alto
Created December 7, 2011 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alto/1443260 to your computer and use it in GitHub Desktop.
Save alto/1443260 to your computer and use it in GitHub Desktop.
Benchmark require time
@timer = Time.now
def log(line)
puts "#{(Time.now - @timer).round(4)} #{line}"
@timer = Time.now
end
module Kernel
def require_logged(required, *args)
puts "require(#{required})"
require_not_logged(required, *args)
end
alias :require_not_logged :require
alias :require :require_logged
def load_logged(required, *args)
puts "load(#{required})"
load_not_logged(required, *args)
end
alias :load_not_logged :load
alias :load :load_logged
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment