Skip to content

Instantly share code, notes, and snippets.

@MartinKoerner
Last active February 12, 2016 15:19
Show Gist options
  • Save MartinKoerner/20f57509a2b3cebc5d69 to your computer and use it in GitHub Desktop.
Save MartinKoerner/20f57509a2b3cebc5d69 to your computer and use it in GitHub Desktop.
Small benchmark for closure tree specs
require 'benchmark'
TEST_COUNT = 20
overall_seconds = 0
tm_outer = Benchmark.measure do
TEST_COUNT.times do |n|
puts "Test run #{n+1}"
tm_inner = Benchmark.measure do
`rake spec all`
end
printf("%.2f seconds\n", tm_inner.real)
overall_seconds += tm_inner.real
end
end
puts '=== Result:'
puts tm_outer.inspect
printf("%.2f seconds\n", tm_outer.real)
puts '=== Average:'
printf("%.2f seconds\n", overall_seconds / TEST_COUNT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment