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

Add a benchmark for web.FileResponse #10095

Merged
merged 6 commits into from
Dec 3, 2024
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Dec 3, 2024

We didn't have any benchmarks for file responses. From the benchmarks it turns out most of the time is creating and processing the executor jobs.

If we combine the stat into a job that returns the open fileobj it will likely be faster and solve #8013

@bdraco bdraco added bot:chronographer:skip This PR does not need to include a change note backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Dec 3, 2024
Copy link

codspeed-hq bot commented Dec 3, 2024

CodSpeed Performance Report

Merging #10095 will not alter performance

Comparing file_response_benchmarks (90cc07c) with master (f733258)

Summary

✅ 44 untouched benchmarks
🆕 2 new benchmarks

Benchmarks breakdown

Benchmark master file_response_benchmarks Change
🆕 test_simple_web_file_response[pyloop] N/A 95.5 ms N/A
🆕 test_simple_web_file_sendfile_fallback_response[pyloop] N/A 101.1 ms N/A

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.76%. Comparing base (f733258) to head (90cc07c).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10095   +/-   ##
=======================================
  Coverage   98.76%   98.76%           
=======================================
  Files         121      122    +1     
  Lines       36866    36904   +38     
  Branches     4396     4400    +4     
=======================================
+ Hits        36409    36447   +38     
  Misses        311      311           
  Partials      146      146           
Flag Coverage Δ
CI-GHA 98.65% <100.00%> (+<0.01%) ⬆️
OS-Linux 98.34% <100.00%> (+<0.01%) ⬆️
OS-Windows 96.18% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.44% <100.00%> (-0.01%) ⬇️
Py-3.10.11 97.29% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 97.83% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 97.87% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.34% <100.00%> (+<0.01%) ⬆️
Py-3.12.7 98.40% <100.00%> (+<0.01%) ⬆️
Py-3.13.0 98.34% <100.00%> (-0.05%) ⬇️
Py-3.9.13 97.21% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 97.75% <100.00%> (-0.05%) ⬇️
Py-pypy7.3.16 97.36% <100.00%> (+<0.01%) ⬆️
VM-macos 97.44% <100.00%> (-0.01%) ⬇️
VM-ubuntu 98.34% <100.00%> (+<0.01%) ⬆️
VM-windows 96.18% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco
Copy link
Member Author

bdraco commented Dec 3, 2024

Probably need one for no sendfile to simulate over tls

@bdraco bdraco marked this pull request as ready for review December 3, 2024 21:04
@bdraco bdraco requested a review from asvetlov as a code owner December 3, 2024 21:04
@bdraco
Copy link
Member Author

bdraco commented Dec 3, 2024

On a side note, all the Python versions we support now implement sendfile fallback so its likely our sendfile fallback code is no longer needed.

@bdraco bdraco merged commit fcce1bf into master Dec 3, 2024
39 checks passed
@bdraco bdraco deleted the file_response_benchmarks branch December 3, 2024 21:06
Copy link
Contributor

patchback bot commented Dec 3, 2024

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/fcce1bf6a5c339a3d63ab1678dcb6658ffc7d570/pr-10095

Backported as #10097

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 3, 2024
We didn't have any benchmarks for file responses. From the benchmarks it
turns out most of the time is creating and processing the executor jobs.

If we combine the stat into a job that returns the open fileobj it will
likely be faster and solve
#8013

(cherry picked from commit fcce1bf)
Copy link
Contributor

patchback bot commented Dec 3, 2024

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/fcce1bf6a5c339a3d63ab1678dcb6658ffc7d570/pr-10095

Backported as #10098

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 3, 2024
We didn't have any benchmarks for file responses. From the benchmarks it
turns out most of the time is creating and processing the executor jobs.

If we combine the stat into a job that returns the open fileobj it will
likely be faster and solve
#8013

(cherry picked from commit fcce1bf)
bdraco added a commit that referenced this pull request Dec 4, 2024
…nse (#10098)

**This is a backport of PR #10095 as merged into master
(fcce1bf).**

We didn't have any benchmarks for file responses. From the benchmarks it
turns out most of the time is creating and processing the executor jobs.

If we combine the stat into a job that returns the open fileobj it will
likely be faster and solve
#8013

Co-authored-by: J. Nick Koston <nick@koston.org>
bdraco added a commit that referenced this pull request Dec 4, 2024
…nse (#10097)

**This is a backport of PR #10095 as merged into master
(fcce1bf).**

We didn't have any benchmarks for file responses. From the benchmarks it
turns out most of the time is creating and processing the executor jobs.

If we combine the stat into a job that returns the open fileobj it will
likely be faster and solve
#8013

Co-authored-by: J. Nick Koston <nick@koston.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant