提交 2d08dda2 编写于 作者: A Ademar de Souza Reis Jr

core.runner: decrease delay between status checks

We have a loop to check for the test status which works
like this:

 status = check_status()
 while not timeout or status:
     status = check_status()
     sleep(step)
     ...

And step was defined as 0.1 (sec). At least on my machine, this was making
avocado quite slow, as it was introducing a 0.1 sec sleep between each test
execution.

This commit changes step to 0.01 secs, making Avocado respond much faster.
Notice there's no significant performance penalty with this change. sleep(0.01)
is a long time for modern CPUs and schedulers.

Benchmark is quite straighforward:

TESTS=$(for i in $(seq 1 100); do echo passtest.py; done)

BEFORE:
    $ time ./scripts/avocado run $TESTS --silent
    real    0m14.007s
    user    0m3.376s
    sys     0m3.112s

AFTER:
    $ time ./scripts/avocado run $TESTS --silent
    real    0m4.741s
    user    0m2.994s
    sys     0m2.953s
Signed-off-by: NAdemar de Souza Reis Jr <areis@redhat.com>
上级 36ce7856
......@@ -379,7 +379,7 @@ class TestRunner(object):
stage_1_msg_displayed = False
stage_2_msg_displayed = False
first = 0.01
step = 0.1
step = 0.01
abort_reason = None
while True:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册