Created
November 14, 2008 01:44
-
-
Save rtomayko/24726 to your computer and use it in GitHub Desktop.
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 '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