Skip to content

Commit 0f800b3

Browse files
committed
Only calculate 'best = min(timings)' once
1 parent 2d4380c commit 0f800b3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Lib/timeit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,14 @@ def format_time(dt):
373373
timings = [dt / number for dt in raw_timings]
374374

375375
best = min(timings)
376+
worst = max(timings)
376377
s = "" if number == 1 else "s"
377378
print(
378379
f"{number} loop{s}, best of {repeat}: "
379380
f"{theme.best}{format_time(best)} {reset}"
380381
f"{theme.per_loop}per loop{reset}"
381382
)
382383

383-
best = min(timings)
384-
worst = max(timings)
385384
if worst >= best * 4:
386385
import warnings
387386

0 commit comments

Comments
 (0)