Skip to content

Instantly share code, notes, and snippets.

@djbender
Created April 13, 2014 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djbender/10596836 to your computer and use it in GitHub Desktop.
Save djbender/10596836 to your computer and use it in GitHub Desktop.
desc "Running all the benchmarks and writing results to file"
task :benchmark do
STDOUT.puts("Benchmarking:")
Dir[File.join(File.dirname(__FILE__), "bench", "**", "*.rb")].each do |benchmark|
STDOUT.puts <<-DOCUMENT
---
file: #{benchmark}
platform: #{RUBY_DESCRIPTION}
timestamp: #{Time.now}
results: |
#{`bundle exec ruby #{benchmark}`.split("-------------------------------------------------").last}
DOCUMENT
end unless ENV["CI"]
end
desc "Run all profiling tests"
task :profile do
Dir[File.join(File.dirname(__FILE__), "prof", "**", "*.rb")].each do |profile|
`bundle exec ruby #{profile}`
end
end
desc "Note each result in a git-note"
task :record do
`git notes add -f -m "#{`bundle exec rake benchmark`}"`
end
desc "Compare current versus last commit"
task :compare do
system "diff -u <(git notes show) <(bundle exec rake benchmark)"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment