Skip to content

Commit

Permalink
Moved gain into main query. Fix gain calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
stanbrub committed Sep 20, 2023
1 parent 91757ef commit 9ceab19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -105,23 +106,26 @@ 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])
return (rates[-1] - m) / m * 100.0

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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 9ceab19

Please sign in to comment.