Skip to content

Commit c3d0e3f

Browse files
committed
[Benchmark] Add CLI argument num_runs
Previously, the number of runs had to be adjusted by changing the corresponding global variable in the script. This can now be done via CLI argument. The default is still 5 runs per system, case, and configuration.
1 parent 68fce79 commit c3d0e3f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

benchmark/Benchmark.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
BENCHMARK_SYSTEMS: list[str] = ['mutable', 'PostgreSQL', 'DuckDB', 'HyPer'] # List of systems
2828

29-
N_RUNS: int = 5
30-
3129

3230
class BenchmarkError(Exception):
3331
pass
@@ -263,7 +261,8 @@ def perform_experiment(
263261
system: str,
264262
info: SimpleNamespace,
265263
results: Result,
266-
output_csv_file: str | None
264+
output_csv_file: str | None,
265+
num_runs: int
267266
) -> None:
268267
# Experiment parameters
269268
systems: dict[str, Any] = yml.get('systems', dict())
@@ -279,7 +278,7 @@ def perform_experiment(
279278

280279
# Perform benchmark
281280
try:
282-
connector_result: ConnectorResult = conn.execute(N_RUNS, params)
281+
connector_result: ConnectorResult = conn.execute(num_runs, params)
283282
except connector.ConnectorException as ex:
284283
tqdm_print(f"\nAn error occurred for {system} while executing {info.path_to_file}: {str(ex)}\n")
285284
raise BenchmarkError()
@@ -479,7 +478,7 @@ def run_benchmarks(args: argparse.Namespace) -> None:
479478
if system == 'mutable':
480479
num_experiments_total += 1
481480
try:
482-
perform_experiment(yml, conn, system, info, results, output_csv_file)
481+
perform_experiment(yml, conn, system, info, results, output_csv_file, args.num_runs)
483482
except BenchmarkError:
484483
pass # nothing to be done
485484
else:
@@ -513,6 +512,8 @@ def run_benchmarks(args: argparse.Namespace) -> None:
513512
help='Specify file to write measurement in CSV format')
514513
parser.add_argument('--args', dest='binargs', metavar='ARGS', default=None, action='store',
515514
help='provide additional arguments to pass through to the binary')
515+
parser.add_argument('-n', '--num-runs', dest='num_runs', metavar='RUNS', default=5, action='store', type=int,
516+
help='specify the number of runs per system, configuration, and case')
516517
parser.add_argument('-v', '--verbose', help='verbose output', dest='verbose', default=False, action='store_true')
517518
parser.add_argument('--pgsql', dest='pgsql', default=False, action='store_true',
518519
help='create a .pgsql file with instructions to insert measurement results into a PostgreSQL '

0 commit comments

Comments
 (0)