Марк Коренберг added the comment:

Well, I'm improving asyncio performance.

Instead of using bytearray as a big buffer and appending to it, I use deque of 
buffers. This eliminates memory copying.

When writing is possible, I call writev()/sendmsg().

Unfortunatelly, OS sets limit on count of buffers passed to writev()/sendmsg(). 
So I should slice deque to cut first N members. This is not possible too, 
deque()[:N] does not work.

So, I decide to use itertools.islice(deque(), 0, N) for that. This work great 
with sendmsg(). But fail with writev().

Also, writev guarantee atimicity with ther writes in kernel, we must not limit 
way of obtainig buffers before passing to kernel.

If Python have emulation of writev() on OS where it is not supported, it should 
be thrown out, because atomicity requirements will not be accomplished. And 
writes to non-seekable fd from another process may be intermixed. Say, for 
example, files opened in append-only mode.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27020>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to