This is an automated email from the ASF dual-hosted git repository.

altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 6f7f5fd4dc2a16624a73300398ebe575db6b1f94
Author: Matthias Feys <matth...@ml6.eu>
AuthorDate: Mon May 14 14:53:10 2018 +0200

    Remove old_div
---
 .../apache_beam/tools/distribution_counter_microbenchmark.py      | 6 ++----
 sdks/python/apache_beam/tools/map_fn_microbenchmark.py            | 4 +---
 sdks/python/apache_beam/tools/sideinput_microbenchmark.py         | 8 +++-----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git 
a/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py 
b/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
index 4f48782..1e0809f 100644
--- a/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
@@ -32,8 +32,6 @@ import sys
 import time
 from builtins import range
 
-from past.utils import old_div
-
 from apache_beam.tools import utils
 
 
@@ -62,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 += old_div(time_cost, num_input)
-  print("Per element update time cost:", old_div(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 6bfd701..e640c2b 100644
--- a/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
@@ -38,8 +38,6 @@ import time
 from builtins import range
 from builtins import zip
 
-from past.utils import old_div
-
 import apache_beam as beam
 from apache_beam.tools import utils
 from scipy import stats
@@ -63,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 ", old_div(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 df36174..7cfdb29 100644
--- a/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
@@ -29,8 +29,6 @@ from __future__ import print_function
 import time
 from builtins import range
 
-from past.utils import old_div
-
 from apache_beam.runners.worker import opcounters
 from apache_beam.runners.worker import sideinputs
 from apache_beam.runners.worker import statesampler
@@ -69,10 +67,10 @@ def run_benchmark(num_runs=50, input_per_source=4000, 
num_sources=4):
 
   print("Runtimes:", times)
 
-  avg_runtime = old_div(sum(times), len(times))
+  avg_runtime = sum(times) // len(times)
   print("Average runtime:", avg_runtime)
-  print("Time per element:", old_div(avg_runtime, (input_per_source *
-                                                   num_sources)))
+  print("Time per element:", avg_runtime // (input_per_source *
+                                             num_sources))
 
 
 if __name__ == '__main__':

-- 
To stop receiving notification emails like this one, please contact
al...@apache.org.

Reply via email to