-
-
Save chrisbloom7/8597765ff0c24f206e6e90b0116fa2ba to your computer and use it in GitHub Desktop.
Benchmarking a rake task
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
# Put this in Rakefile (doesn't matter where) | |
require 'benchmark' | |
class Rake::Task | |
def execute_with_benchmark(*args) | |
bm = Benchmark.measure { execute_without_benchmark(*args) } | |
puts " #{name} --> #{bm}" | |
end | |
alias_method :execute_without_benchmark, :execute | |
alias_method :execute, :execute_with_benchmark | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment