[Python-ideas] Tulip / PEP 3156 event loop implementation question: CPU vs. I/O starvation

Nick Coghlan ncoghlan at gmail.com
Sat Jan 12 10:53:27 CET 2013


On Sat, Jan 12, 2013 at 4:39 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Yep, it could simply use itertools.islice() when iterating over _ready with
> an appropriate upper bound factor relative to the actual length, and then
> cut down the list after the loop. So it would never go, say, 50% over the
> initially anticipated workload. Or rather a fixed number, I guess, to make
> it more predictable for users. That would be a user configurable parameter
> to the I/O loop.
>
>     actual_limit = len(_ready) + max_additional_load_per_loop
>     for handler in itertools.islice(_ready, None, actual_limit):
>         call handler...
>     del _ready[:actual_limit]

But do we need that in the reference loop? It seems like additional
complexity when it has yet to be demonstrated that the simple solution
of alternating processing of call_soon registrations with IO callbacks
is inadequate.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list