Skip to content
Snippets Groups Projects
Commit e2838803db6e authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Include first measurement in collected benchmark times

If the first measurement is > 30, the function returned median([]) which return
0.0.
Include the first measurement in timings to avoid such case.
parent f55e7b52e926
No related branches found
No related tags found
No related merge requests found
......@@ -157,6 +157,4 @@
def _timeit(self, func, args=(), kwargs=None):
kwargs = kwargs or {}
# Do a first measurement
first_measure = func(*args, **kwargs)
n = int(30 / first_measure)
times = []
......@@ -162,4 +160,6 @@
times = []
times.append(func(*args, **kwargs))
n = int(30 / times[0])
for i in range(n):
times.append(func(*args, **kwargs))
return median(times)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment