Because we have 1000 tasks scheduled for execution on the next loop iteration. First consumes 10ms and pauses (switches context). The next task is executed *in the same loop iteration*, it consumes own 10ms and switches. The same is repeated for all 1000 tasks in *the same loop iteration*, I want to stress this fact. 10 sec as the result (really even a little more, asyncio need time to execute self code too).
On Fri, Jun 14, 2019 at 6:47 PM Nikita Melentev <multisosnoo...@gmail.com> wrote: > > Are you sure in your calculations? If we have 1000 task switches at the "same > time", then "after" one task start to do the job, then after 10ms it will > `sleep(0)` and loop will have time to choose next task. Why loop will be > paused in this case? > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/XLXI57JYP6DXDBQIBCV4SUD4DRUN3JW4/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Thanks, Andrew Svetlov _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/K3Q2GEXM64SQAR6RL5R5CMCOPPMRU4CA/ Code of Conduct: http://python.org/psf/codeofconduct/