[BEAM-5255] Fix over-aggressive division futurization in benchmarks.
diff --git a/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py b/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
index 1e0809f..06035d5 100644
--- a/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
@@ -60,8 +60,8 @@
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__':
diff --git a/sdks/python/apache_beam/tools/map_fn_microbenchmark.py b/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
index 116c28e..6b4a143 100644
--- a/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
@@ -61,7 +61,7 @@
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)
diff --git a/sdks/python/apache_beam/tools/sideinput_microbenchmark.py b/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
index f517304..8754d86 100644
--- a/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
@@ -69,10 +69,10 @@
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__':