Created
December 22, 2011 09:45
-
-
Save rahul100885/1509722 to your computer and use it in GitHub Desktop.
Benchmarking for uuid and hex(16)
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 'benchmark' | |
require 'securerandom' | |
Benchmark.bm(7) do |x| | |
x.report("UUID") { SecureRandom.uuid } | |
x.report("hex(16)") { SecureRandom.hex(16) } | |
end | |
#Output | |
# user system total real | |
#UUID 0.000000 0.000000 0.000000 ( 0.000182) | |
#hex(16) 0.000000 0.000000 0.000000 ( 0.000010) | |
# user system total real | |
#UUID 0.000000 0.000000 0.000000 ( 0.000152) | |
#hex(16) 0.000000 0.000000 0.000000 ( 0.000010) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment