Skip to content

Commit a251531

Browse files
committed
Better performance optimization in test
1 parent cdf535f commit a251531

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

atest/testdata/running/timeouts_with_logging.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ def python_logger():
2727
_log_a_lot(logging.info)
2828

2929

30-
def _log_a_lot(info):
31-
# Assigning local variables is performance optimization to give as much
32-
# time as possible for actual logging.
33-
msg = MSG
34-
sleep = time.sleep
35-
current = time.time
30+
# Binding global values to argument default values is a performance optimization
31+
# to give as much time as possible for actual logging.
32+
def _log_a_lot(info, msg=MSG, sleep=time.sleep, current=time.time):
3633
end = current() + 1
3734
while current() < end:
3835
info(msg)

0 commit comments

Comments
 (0)