[PR #13515/495e7783 backport][3.15] Drop the mock protocol from the multipart benchmarks by patchback[bot] · Pull Request #13518 · aio-libs/aiohttp · GitHub
Skip to content

[PR #13515/495e7783 backport][3.15] Drop the mock protocol from the multipart benchmarks - #13518

Merged
bdraco merged 1 commit into
3.15from
patchback/backports/3.15/495e778360d1924da63e16dba0f0d76baf56a56a/pr-13515
Aug 23, 2026
Merged

bdraco merged 1 commit into
3.15from
patchback/backports/3.15/495e778360d1924da63e16dba0f0d76baf56a56a/pr-13515

Conversation

@patchback

@patchback patchback Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This is a backport of PR #13515 as merged into master (495e778).

What do these changes do?

The multipart benchmarks built their StreamReader on a mock.Mock protocol, so every chunk read went through a mock resume_reading() call; that was about a third of the measured time and it is sensitive to the runner environment, which showed up as a spurious 10% regression on #13514. Use a BaseProtocol subclass with no-op flow control instead, as the websocket benchmarks already do.

Are there changes in behavior for the user?

No, benchmarks only.

Is it a substantial burden for the maintainers to support this?

No.

Related issue number

Follow up to #13509, noise seen on #13514.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes N/A
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt N/A
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder N/A
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

Drafted with Claude Fable 5; reviewed by @bdraco.

@patchback
patchback Bot requested a review from asvetlov as a code owner August 22, 2026 18:29
@bdraco
bdraco enabled auto-merge (squash) August 22, 2026 18:33
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown

Comment thread tests/test_benchmarks_multipart.py
@codecov

codecov Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.25%. Comparing base (4e5cc05) to head (71115c8).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             3.15   #13518   +/-   ##
=======================================
  Coverage   96.25%   96.25%           
=======================================
  Files         160      160           
  Lines       51365    51368    +3     
  Branches     2795     2795           
=======================================
+ Hits        49442    49445    +3     
  Misses       1747     1747           
  Partials      176      176           
Flag Coverage Δ
CI-GHA 96.22% <100.00%> (+<0.01%) ⬆️
OS-Linux 96.00% <100.00%> (+<0.01%) ⬆️
OS-Windows 93.72% <100.00%> (-0.01%) ⬇️
OS-macOS 95.18% <100.00%> (-0.01%) ⬇️
Py-3.10 95.36% <100.00%> (+<0.01%) ⬆️
Py-3.11 95.61% <100.00%> (+<0.01%) ⬆️
Py-3.12 95.69% <100.00%> (+<0.01%) ⬆️
Py-3.13 95.68% <100.00%> (+<0.01%) ⬆️
Py-3.14 95.78% <100.00%> (+<0.01%) ⬆️
Py-3.14t 94.80% <100.00%> (+<0.01%) ⬆️
Py-pypy-3.11 94.64% <100.00%> (+<0.01%) ⬆️
VM-macos 95.18% <100.00%> (-0.01%) ⬇️
VM-ubuntu 96.00% <100.00%> (+<0.01%) ⬆️
VM-windows 93.72% <100.00%> (-0.01%) ⬇️
cython-coverage 78.91% <ø> (+<0.01%) ⬆️

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

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

@codspeed

codspeed Bot commented Aug 22, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 39.69%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 84 untouched benchmarks
⏩ 86 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_read_base64_part[pyloop] 20.8 ms 12.6 ms +64.99%
⚡ test_read_chunk_base64_realignment[pyloop] 7.5 ms 6.3 ms +18.26%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing patchback/backports/3.15/495e778360d1924da63e16dba0f0d76baf56a56a/pr-13515 (71115c8) with 3.15 (4e5cc05)

Open in CodSpeed

Footnotes

  1. 86 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@bdraco
bdraco merged commit baf0867 into 3.15 Aug 23, 2026
48 checks passed
@bdraco
bdraco deleted the patchback/backports/3.15/495e778360d1924da63e16dba0f0d76baf56a56a/pr-13515 branch August 23, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant