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
JacobCoffee
changed the title
Enhancement: use SendFile
We should use loop.sendfile to send files and fallback to chunking. This is significantly more performant.
Enhancement: Swap to using Python stdlib couroutine loop.SendFile
Feb 28, 2023
JacobCoffee
changed the title
Enhancement: Swap to using Python stdlib couroutine loop.SendFile
Enhancement: Use Python stdlib couroutine loop.SendFile for sending files
Feb 28, 2023
Update- This appears to be more complex than I assumed. the sendfile method is not implemented on all loops at all. Furthermore, it requires access to the async transport, which is a low level abstraction defined by the asyncio implementation but not anyio.
PROS: dramatically faster file serving using the operating system.
CONS: a lot more complexity and only support on asyncio.
We should use
loop.sendfile
(Introduced in Python 3.7) to send files and fallback to chunking. This is significantly more performant.(edited by @JacobCoffee)
The text was updated successfully, but these errors were encountered: