Created
February 4, 2010 18:44
-
-
Save skaes/294965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'rubygems' | |
require 'benchmark' | |
require 'uuid4r' | |
require 'uuidtools' | |
log = false | |
iterations = (ARGV.shift || 1_000_000).to_i | |
puts "# of iterations = #{iterations}" | |
Benchmark::bm(20) do |x| | |
x.report("null_time") do | |
for i in 0..iterations do | |
# do nothing | |
end | |
end | |
GC.enable_stats if log | |
GC.enable_trace if log | |
GC.start | |
GC.log_file "uuid4r.log" if log | |
x.report("uuid4r") do | |
iterations.times do | |
UUID4R::uuid(1) | |
end | |
end | |
GC.start | |
GC.log_file "uuidtools.log" if log | |
x.report("uuidtools") do | |
iterations.times do | |
UUIDTools::UUID.timestamp_create.to_s | |
end | |
end | |
GC.start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment