Why is await async so slow?

前端 未结 4 1066
粉色の甜心
粉色の甜心 2020-12-14 18:27

I finally got VS2012 and got a simple demo up and working to check out the potential performance boost of async and await, but to my dismay it is slower! Its possible I\'m d

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 19:05

    On a quick look, the results are expected: your async sum is using just one thread, while you asynchronously wait for it to finish, so it's slower than the multi-threaded sum.

    You'd use async in case you have something else to finish while it's doing its job. So, this wouldn't be the right test for any speed/response improvements.

提交回复
热议问题