qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] test-coroutine: add baseline test that times th


From: Ming Lei
Subject: Re: [Qemu-devel] [PATCH] test-coroutine: add baseline test that times the cost of function calls
Date: Mon, 11 Aug 2014 08:44:18 +0800

Hi,

On Wed, Aug 6, 2014 at 5:33 PM, Paolo Bonzini <address@hidden> wrote:
> This can be used to compute the cost of coroutine operations.  In the
> end the cost of the function call is a few clock cycles, so it's pretty
> cheap for now, but it may become more relevant as the coroutine code
> is optimized.
>
> For example, here are the results on my machine:
>
>    Function call 100000000 iterations: 0.173884 s
>    Yield 100000000 iterations: 8.445064 s
>    Lifecycle 1000000 iterations: 0.098445 s
>    Nesting 10000 iterations of 1000 depth each: 7.406431 s
>
> One yield takes 83 nanoseconds, one enter takes 97 nanoseconds,
> one coroutine allocation takes (roughly, since some of the allocations
> in the nesting test do hit the pool) 739 nanoseconds:
>
>    (8.445064 - 0.173884) * 10^9 / 100000000 = 82.7
>    (0.098445 * 100 - 0.173884) * 10^9 / 100000000 = 96.7
>    (7.406431 * 10 - 0.173884) * 10^9 / 100000000 = 738.9

IMO, it isn't enough to only consider the cost of coroutine APIs,
given stack is switched back and forth and its usage is inevitable
in reality, the cost of this part should be tested too.

I will post a patch to test costs of coroutine from user view today,
so that the total costs can be observed with using coroutine.

Thanks,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]