File: benchmark.rake

package info (click to toggle)
ruby-character-set 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: ansic: 2,597; ruby: 1,290; makefile: 7; sh: 4
file content (20 lines) | stat: -rw-r--r-- 697 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
desc 'Run all IPS benchmarks'
task :benchmark do
  Dir["#{__dir__}/benchmarks/*.rb"].sort.each { |file| load(file) }
end

namespace :benchmark do
  desc 'Run all IPS benchmarks and store the comparison results in BENCHMARK.md'
  task :write_to_file do
    Rake.application[:benchmark].invoke

    # extract comparison results from reports
    results = $benchmark_results
      .map { |caption, report| "```\n#{caption}\n\n#{report[/(?<=Comparison:).+/m].strip}\n```" }
      .join("\n")
      .gsub(/ \(±[^)]+\) |(?<=same-ish).*/, '') # remove some noise

    File.write "#{__dir__}/../BENCHMARK.md",
               "Results of `rake:benchmark` on #{RUBY_DESCRIPTION}\n\n#{results}\n"
  end
end