You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started having a look at this but I'm not sure how you intend the API. Do you think that trio.socket.sendfile should accept AsyncIOWrapper, plain file objects, or both?
Oh shoot, that's an excellent question. I was just thinking about wrapping sendfile in the obvious naive way, like we wrap send or whatever, but I forgot that this may cause synchronous disk access. And it's a bit tricky, because we could route it through a thread like we do with other disk access, but in this case that might add enough overhead to defeat the purpose of using sendfile in the first place. It's also unclear whether a thread is really necessary on Windows – maybe TransmitFile does async disk I/o natively?
It would help to have more information. I guess one way forward would be to start by making a toy little benchmark that uses sendfile in the naive way on Linux, and compare it to read+send, to see what benefit we can even hope to get?
Activity
njsmith commentedon Jan 19, 2018
Asyncio support is coming in 3.7: https://bugs.python.org/issue32410
sseg commentedon Apr 14, 2018
I started having a look at this but I'm not sure how you intend the API. Do you think that
trio.socket.sendfileshould acceptAsyncIOWrapper, plainfileobjects, or both?njsmith commentedon Apr 14, 2018
Oh shoot, that's an excellent question. I was just thinking about wrapping
sendfilein the obvious naive way, like we wrapsendor whatever, but I forgot that this may cause synchronous disk access. And it's a bit tricky, because we could route it through a thread like we do with other disk access, but in this case that might add enough overhead to defeat the purpose of usingsendfilein the first place. It's also unclear whether a thread is really necessary on Windows – maybeTransmitFiledoes async disk I/o natively?It would help to have more information. I guess one way forward would be to start by making a toy little benchmark that uses
sendfilein the naive way on Linux, and compare it toread+send, to see what benefit we can even hope to get?pipehappy1 commentedon Jan 17, 2020
Do we have any update on this? Having sendfile in the API would be nice.