File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ module RubybenchOneshot
2+ class << self
3+ end
4+ end
5+
16namespace :oneshot do
27 desc 'Remove duplicated commit'
38 task remove_duplicates : :environment do
@@ -17,4 +22,27 @@ namespace :oneshot do
1722 end
1823 end
1924 end
25+
26+ desc 'Resolve legacy typo'
27+ task normalize_rss : :environment do
28+ wrong_type = BenchmarkResultType . find_by! ( name : 'RSS memory usage' , unit : 'Kilobtyes' )
29+ right_type = BenchmarkResultType . find_by! ( name : 'RSS memory usage' , unit : 'Kilobytes' )
30+
31+ BenchmarkType . all . each do |benchmark_type |
32+ unless benchmark_type . script_url . match ( %r[\A https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmark/] )
33+ next
34+ end
35+
36+ original_type = BenchmarkType . where . not ( id : benchmark_type . id ) . find_by ( category : benchmark_type . category )
37+ if original_type . nil? || !original_type . script_url . match ( %r[\A https://raw.githubusercontent.com/ruby-bench/ruby-bench-suite/master/ruby/benchmarks/bm_] )
38+ next
39+ end
40+
41+ puts "benchmark_type: #{ benchmark_type . id } "
42+ original_type . benchmark_runs . where ( benchmark_result_type : wrong_type ) . update_all (
43+ benchmark_result_type_id : right_type . id ,
44+ benchmark_type_id : benchmark_type . id ,
45+ )
46+ end
47+ end
2048end
You can’t perform that action at this time.
0 commit comments