Created
October 22, 2021 06:01
-
-
Save Omochice/a09da508eb3c1661b0804c335f6fdc96 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 "benchmark" | |
Benchmark.bm do |x| | |
count = 10000 | |
mappings = { "a" => [1, 1], "t" => [-1, 1], "g" => [-1, -1], "c" => [1, -1] } | |
x.report("hash.values.sample.size") do | |
_ = mappings.values.sample.size | |
end | |
x.report("hash.values[0].length ") do | |
_ = mappings.values[0].length | |
end | |
end |
Author
Omochice
commented
Oct 22, 2021
•
user | system | total | real | |
---|---|---|---|---|
hash.values.sample.size | 0.000033 | 0.000009 | 0.000042 | ( 0.000037) |
hash.values[0].length | 0.000003 | 0.000001 | 0.000004 | ( 0.000003) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment