Sha256: 84ad488a8ff4115559c214ef23e68f91e35f217534a578547a1bc40c056bf22b

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

all_benchmark_tasks = []

namespace(:benchmark) do
  
  Dir[File.join(File.dirname(__FILE__), '..', 'benchmarks', '*_benchmark.rb')]. each do |benchmark_file|
    task_name = File.basename(benchmark_file, '_benchmark.rb').to_sym
    
    desc "Run the #{task_name} benchmark."
    task(task_name, :n) do |task, args|
      ENV['N'] = args[:n] if args[:n]
      load(File.expand_path(benchmark_file))
    end
    
    all_benchmark_tasks << "benchmark:#{task_name}"
  end
end

unless all_benchmark_tasks.empty?
  desc 'Run the whole benchmark suite'
  task(:benchmark, :n) do |task, args|
    all_benchmark_tasks.each do |t|
      task(t).invoke(args[:n])
      puts
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bench9000-0.1 vendor/chunky_png/tasks/benchmarks.rake