From 362dae3ace840883dd439ca77b20b8ef13f67322 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 29 Mar 2021 12:48:34 -0400 Subject: [PATCH 1/3] simplify check_output --- run_benchmarks.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/run_benchmarks.rb b/run_benchmarks.rb index 14e0d58f..5a97f6f8 100755 --- a/run_benchmarks.rb +++ b/run_benchmarks.rb @@ -14,10 +14,7 @@ def check_call(args) end def check_output(args) - IO.popen(args) do |pipe| - output = pipe.read - return output - end + IO.popen(args).read end def build_yjit(repo_dir) From 262bed59f114ad9132cc875d63cc5c12b56471a3 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 29 Mar 2021 12:57:03 -0400 Subject: [PATCH 2/3] use idiomatic string interpolation --- run_benchmarks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_benchmarks.rb b/run_benchmarks.rb index 5a97f6f8..4b8b93af 100755 --- a/run_benchmarks.rb +++ b/run_benchmarks.rb @@ -19,7 +19,7 @@ def check_output(args) def build_yjit(repo_dir) if !File.exist?(repo_dir) - puts('Directory does not exist "' + repo_dir + '"') + puts("Directory does not exist \"#{repo_dir}\"") exit(-1) end @@ -39,7 +39,7 @@ def build_yjit(repo_dir) #n_cores = os.cpu_count() n_cores = 32 puts("Building YJIT with #{n_cores} processes") - check_call(['make', '-j' + n_cores.to_s, 'install']) + check_call(["make", "-j#{n_cores}", "install"]) end end From ae3094555515d040cd93182e4073c6844478d970 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 29 Mar 2021 12:57:34 -0400 Subject: [PATCH 3/3] combine join and map into one line --- run_benchmarks.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/run_benchmarks.rb b/run_benchmarks.rb index 4b8b93af..2a22efae 100755 --- a/run_benchmarks.rb +++ b/run_benchmarks.rb @@ -123,8 +123,7 @@ def trim_cell(cell) end # Row of separator dashes - sep_row = (0...num_cols).map { |i| '-' * table_data[0][i].length } - sep_row = sep_row.join(' ') + sep_row = (0...num_cols).map { |i| '-' * table_data[0][i].length }.join(' ') out = sep_row + "\n"