Skip to content

Commit

Permalink
Merge pull request apache#6293 [BEAM-5255] Fix over-aggressive divisi…
Browse files Browse the repository at this point in the history
…on futurization in benchmarks.

[BEAM-5255] Fix over-aggressive division futurization in benchmarks.
  • Loading branch information
robertwb authored Aug 29, 2018
2 parents 053b1d8 + 4e5c642 commit e278e57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def run_benchmark(num_runs=100, num_input=10000, seed=time.time()):
counter.add_inputs_for_test(inputs)
time_cost = time.time() - start
print("Run %d: Total time cost %g sec" % (i+1, time_cost))
total_time += time_cost // num_input
print("Per element update time cost:", total_time // num_runs)
total_time += time_cost / num_input
print("Per element update time cost:", total_time / num_runs)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/tools/map_fn_microbenchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_benchmark(num_maps=100, num_runs=10, num_elements_step=1000):
gradient, intercept, r_value, p_value, std_err = stats.linregress(
*list(zip(*list(timings.items()))))
print("Fixed cost ", intercept)
print("Per-element ", gradient // num_maps)
print("Per-element ", gradient / num_maps)
print("R^2 ", r_value**2)


Expand Down
6 changes: 3 additions & 3 deletions sdks/python/apache_beam/tools/sideinput_microbenchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def run_benchmark(num_runs=50, input_per_source=4000, num_sources=4):

print("Runtimes:", times)

avg_runtime = sum(times) // len(times)
avg_runtime = sum(times) / len(times)
print("Average runtime:", avg_runtime)
print("Time per element:", avg_runtime // (input_per_source *
num_sources))
print("Time per element:", avg_runtime / (input_per_source *
num_sources))


if __name__ == '__main__':
Expand Down

0 comments on commit e278e57

Please sign in to comment.