[
https://issues.apache.org/jira/browse/BEAM-5255?focusedWorklogId=139301&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-139301
]
ASF GitHub Bot logged work on BEAM-5255:
----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Aug/18 16:05
Start Date: 29/Aug/18 16:05
Worklog Time Spent: 10m
Work Description: robertwb closed pull request #6293: [BEAM-5255] Fix
over-aggressive division futurization in benchmarks.
URL: https://github.com/apache/beam/pull/6293
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
b/sdks/python/apache_beam/tools/distribution_counter_microbenchmark.py
index 1e0809f0c11..06035d55872 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 @@ 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__':
diff --git a/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
b/sdks/python/apache_beam/tools/map_fn_microbenchmark.py
index 116c28e853e..6b4a143e2e1 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 @@ 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)
diff --git a/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
b/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
index f517304302c..8754d8604eb 100644
--- a/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
+++ b/sdks/python/apache_beam/tools/sideinput_microbenchmark.py
@@ -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__':
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 139301)
Time Spent: 40m (was: 0.5h)
> Fix over-aggressive division futurization.
> ------------------------------------------
>
> Key: BEAM-5255
> URL: https://issues.apache.org/jira/browse/BEAM-5255
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Affects Versions: 2.6.0
> Reporter: Robert Bradshaw
> Assignee: Valentyn Tymofieiev
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> When converting from Python 2 to Python 3, `a / b` becomes `a // b` only for
> ints, but it is incorrect to do this substitution for floating point
> division.
>
> I noticed this change in the microbenchmarks, but we should do an audit to
> make sure we haven't broken things elsewhere.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)