Created
January 8, 2018 08:54
-
-
Save srMarquinho/fd27b7d3243e57fa8e742227f0afc0fd to your computer and use it in GitHub Desktop.
ruby benchmark snipet example
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' | |
n = (10**6) | |
Benchmark.bm(7) do |x| | |
x.report("1:") do | |
1.upto(n) do | |
#code | |
end | |
end | |
x.report("2:") do | |
1.upto(n) do | |
#code | |
end | |
end | |
x.report("3:") do | |
1.upto(n) do | |
#code | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment