Skip to content

Commit

Permalink
Merge pull request #1 from MSeifert04/at-least-repeats
Browse files Browse the repository at this point in the history
Make sure there is always at least one repeat for each benchmark
  • Loading branch information
MSeifert04 authored Apr 15, 2018
2 parents aa6b728 + 10d3e92 commit 5a35819
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions simple_benchmark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def _estimate_number_of_repeats(func, target_seconds):
# of the timer isn't a limiting factor.
if single_time < 1e-4:
factor = 1e-4 / single_time
return int(n_repeats // factor), int(factor)
return max(int(n_repeats // factor), 1), max(int(factor), 1)
# Otherwise the number of timings each repeat should be 1.
# However make sure there are at least 3 repeats for each function!
return min(3, n_repeats), 1
return max(n_repeats, 3), 1


def benchmark(
Expand Down

0 comments on commit 5a35819

Please sign in to comment.