Skip to content

Instantly share code, notes, and snippets.

@rtomayko
Created November 14, 2008 01:44
Show Gist options
  • Save rtomayko/24726 to your computer and use it in GitHub Desktop.
Save rtomayko/24726 to your computer and use it in GitHub Desktop.
require 'time'
start = Time.now
10000.times do
require 'time'
end
duration = Time.now - start
printf "require: %f\n", duration
start = Time.now
10000.times do
defined? ::Time
end
duration = Time.now - start
printf "defined?: %f\n", duration
# ruby require_vs_defined.rb
# require: 1.105543
# defined?: 0.003817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment