-
-
Notifications
You must be signed in to change notification settings - Fork 178
Optimize transport.write #389
Comments
First of all, bytearray based buffer is used already, for most transports except bytearray-based bufferPros:
Cons:
#339Pros:
Cons:
Summary of benchmarkFrom #339 (comment) small data:
large data:
|
@methane @socketpair Alright, I think we should first merge #385. As for #339 -- I feel a bit uneasy about it. I want asyncio to be fast in all use cases, but the PR is invasive and makes the code much more complex. An ideal solution would be to adaptively use bytearray to aggregate small writes in one buffer, and use vectorized writes for series of big I'm wondering if we can design a nice fast buffer abstraction to do this. It should be separated from IO, and thoroughly tested. Then we can add
This is something we need to fix if we are to merge #339. A quick fix is it convert anything that's not bytes to bytes (if the first try-write fails with a BlockingIOError). |
OK ? |
I will prototype my idea, faster buffer implementation. |
@socketpair If you can simplify the tests then sure, make a PR. @methane If I don't review the C Future patch this week feel free to ping me again on the issue tracker sometime next week. |
Well, please don't close. Seems I will find a time to fix/refactor that |
Closing this issue now. |
So we have two PRs atm:
I reviewed the second one, and I thought it's actually quite ready to be merged. Now I'm a bit lost between two separate PRs fixing same thing in different ways.
Let's discuss both PRs in this one issue and decide which one is the way to go.
FWIW I've updated uvloop quite a while ago to avoid using custom bytearray buffers, preferring the
writev
sys call instead.The text was updated successfully, but these errors were encountered: