Skip to content

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

Merged
asvetlov merged 4 commits intomasterfrom
native-sendfile
Jan 19, 2020
Merged

Use loop.sendfile() instead of custom implementation if available#4517
asvetlov merged 4 commits intomasterfrom
native-sendfile

Conversation

@asvetlov
Copy link
Copy Markdown
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
Copy Markdown

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]>
async def sendfile(self) -> None:
assert self.transport is not None
loop = self.loop
data = b''.join(self._sendfile_buffer)
Copy link
Copy Markdown
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
Copy Markdown
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