Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use loop.sendfile() instead of custom implementation if available #4517

Merged
merged 4 commits into from
Jan 19, 2020

Conversation

asvetlov
Copy link
Member

Fix #4269

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jan 19, 2020
@codecov-io
Copy link

codecov-io commented Jan 19, 2020

Codecov Report

Merging #4517 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4517      +/-   ##
==========================================
- Coverage    97.6%   97.59%   -0.01%     
==========================================
  Files          43       43              
  Lines        8899     8907       +8     
  Branches     1402     1403       +1     
==========================================
+ Hits         8686     8693       +7     
- Misses         94       95       +1     
  Partials      119      119
Impacted Files Coverage Δ
aiohttp/web_fileresponse.py 97.82% <100%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec493d6...5d6375b. Read the comment docs.

@asvetlov asvetlov merged commit e6f04ce into master Jan 19, 2020
@asvetlov asvetlov deleted the native-sendfile branch January 19, 2020 12:37
asvetlov added a commit that referenced this pull request Jan 19, 2020
…le (#4517)

(cherry picked from commit e6f04ce)

Co-authored-by: Andrew Svetlov <[email protected]>
asvetlov added a commit that referenced this pull request Jan 19, 2020
…le (#4517) (#4518)

(cherry picked from commit e6f04ce)

Co-authored-by: Andrew Svetlov <[email protected]>
@@ -94,12 +95,25 @@ def _done_fut(self, out_fd: int, fut: 'asyncio.Future[None]') -> None:

async def sendfile(self) -> None:
assert self.transport is not None
loop = self.loop
data = b''.join(self._sendfile_buffer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the use of memoryview() be faster in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that the speed difference is visible at all.
You can measure it if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use loop.sendfile() for file sending on Python 3.7+
3 participants