Skip to content

Instantly share code, notes, and snippets.

@srMarquinho
Created January 8, 2018 08:54
Show Gist options
  • Save srMarquinho/fd27b7d3243e57fa8e742227f0afc0fd to your computer and use it in GitHub Desktop.
Save srMarquinho/fd27b7d3243e57fa8e742227f0afc0fd to your computer and use it in GitHub Desktop.
ruby benchmark snipet example
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