Created
April 13, 2014 18:48
-
-
Save djbender/10596836 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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