From 9ceab198fe59040d46e5d0852a9b849ce0f63dad Mon Sep 17 00:00:00 2001 From: stanbrub Date: Wed, 20 Sep 2023 11:47:23 -0600 Subject: [PATCH] Moved gain into main query. Fix gain calculation --- .../benchmark/run/profile/benchmark_tables.dh.py | 14 +++++++++----- .../benchmark/run/profile/queries/nightly.py | 3 --- .../benchmark/run/profile/queries/release.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/resources/io/deephaven/benchmark/run/profile/benchmark_tables.dh.py b/src/main/resources/io/deephaven/benchmark/run/profile/benchmark_tables.dh.py index 4c052b15..a1e85509 100644 --- a/src/main/resources/io/deephaven/benchmark/run/profile/benchmark_tables.dh.py +++ b/src/main/resources/io/deephaven/benchmark/run/profile/benchmark_tables.dh.py @@ -55,11 +55,12 @@ def merge_run_tables(parent_uri, run_ids, category, csv_file_name, schema = None default_storage_uri = 'https://storage.googleapis.com/deephaven-benchmark' default_category = 'nightly' default_max_runs = 5 -default_history = 5 +default_history_runs = 5 storage_uri = benchmark_storage_uri_arg if 'benchmark_storage_uri_arg' in globals() else default_storage_uri category = benchmark_category_arg if 'benchmark_category_arg' in globals() else default_category max_runs = benchmark_max_runs_arg if 'benchmark_max_runs_arg' in globals() else default_max_runs +history_runs = benchmark_history_runs_arg if 'benchmark_history_runs_arg' in globals() else default_history_runs run_ids = get_run_ids(storage_uri, category, max_runs) bench_results = merge_run_tables(storage_uri, run_ids, category, 'benchmark-results.csv', s_results) bench_metrics = merge_run_tables(storage_uri, run_ids, category, 'benchmark-metrics.csv') @@ -105,7 +106,7 @@ def rstd(rates): return statistics.pstdev(rates) * 100.0 / statistics.mean(rates) from array import array -def rchange(rates): +def rchange(rates) -> float: rates = array('l', rates) if(len(rates) < 2): return 0.0 m = statistics.mean(rates[:-1]) @@ -113,15 +114,18 @@ def rchange(rates): def format_rates(rates): return ' '.join("{:,}".format(r) for r in rates) + +def gain(start:float, end:float) -> float: + return (end - start) / start * 100.0 from deephaven.updateby import rolling_group_tick -op_group = rolling_group_tick(cols=["op_group_rates = op_rate"], rev_ticks=default_history, fwd_ticks=0) -op_version = rolling_group_tick(cols=["op_group_versions = deephaven_version"], rev_ticks=default_history, fwd_ticks=0) +op_group = rolling_group_tick(cols=["op_group_rates = op_rate"], rev_ticks=history_runs, fwd_ticks=0) +op_version = rolling_group_tick(cols=["op_group_versions = deephaven_version"], rev_ticks=history_runs, fwd_ticks=0) bench_results_change = bench_results_diff.sort(['benchmark_name', 'origin', 'deephaven_version', 'timestamp']) bench_results_change = bench_results_change.update_by(ops=[op_group, op_version], by=['benchmark_name', 'origin']) bench_results_change = bench_results_change.update( - ['op_rate_variability=(double)rstd(op_group_rates)', 'op_rate_change=(double)rchange(op_group_rates)'] + ['op_rate_variability=(float)rstd(op_group_rates)', 'op_rate_change=(float)rchange(op_group_rates)'] ) bench_results_change = bench_results_change.view( ['benchmark_name', 'origin', 'timestamp', 'deephaven_version', 'op_duration', 'op_rate', diff --git a/src/main/resources/io/deephaven/benchmark/run/profile/queries/nightly.py b/src/main/resources/io/deephaven/benchmark/run/profile/queries/nightly.py index fa129030..ad1a8181 100644 --- a/src/main/resources/io/deephaven/benchmark/run/profile/queries/nightly.py +++ b/src/main/resources/io/deephaven/benchmark/run/profile/queries/nightly.py @@ -13,9 +13,6 @@ benchmark_max_runs_arg = 20 # Latest X runs to include exec(r.read().decode(), globals(), locals()) -def gain(start:float, end:float) -> float: - return (end - start) / start * 100.0 - def op_by_date_range(begin_millis, end_millis, op_prefix): interval_millis = 43200000 begin_interval = int(begin_millis / interval_millis) diff --git a/src/main/resources/io/deephaven/benchmark/run/profile/queries/release.py b/src/main/resources/io/deephaven/benchmark/run/profile/queries/release.py index d038600f..86ab7e80 100644 --- a/src/main/resources/io/deephaven/benchmark/run/profile/queries/release.py +++ b/src/main/resources/io/deephaven/benchmark/run/profile/queries/release.py @@ -30,7 +30,7 @@ past_static_rates = newest_benchmarks.where([ 'versLen <= len(op_group_rates)', 'benchmark_name.endsWith(`-Static`)' ]).update([ - 'Change=(op_group_rates[versLen-1] - op_group_rates[versLen-2])/op_group_rates[versLen-1]*100' + 'Change=(float)gain(op_group_rates[versLen-2], op_group_rates[versLen-1])' ]).update([ (vers[i] + "=op_group_rates[" + str(i) + "]") for i in reversed(range(versLen)) ]).view([