Skip to content

Add CodSpeed performance benchmarks#1

Open
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed-wizard-1778948857097
Open

Add CodSpeed performance benchmarks#1
codspeed-hq[bot] wants to merge 1 commit into
mainfrom
codspeed-wizard-1778948857097

Conversation

@codspeed-hq
Copy link
Copy Markdown

@codspeed-hq codspeed-hq Bot commented May 16, 2026

This PR integrates CodSpeed for continuous performance tracking on httpx2.

What changed

Benchmark tests (tests/benchmarks/): 31 benchmarks covering the performance-critical paths of the library:

  • URL parsing (7 benchmarks): Simple URLs, query/fragment handling, complex URLs with userinfo and port, IPv6, IDNA unicode hosts, long paths, percent-encoded characters.
  • Headers (5 benchmarks): Construction from lists, key lookup, containment checks, iteration, and copying.
  • Request/Response construction (7 benchmarks): GET and POST requests (JSON, form-encoded, with headers), text/JSON/HTML response construction.
  • Content encoding (6 benchmarks): Small and medium byte payloads, string encoding, URL-encoded form data, small and nested JSON bodies.
  • Decoders (4 benchmarks): Identity decoder, text decoder, line decoder, byte chunker.
  • URL object (2 benchmarks): URL construction and copy_with.

CI workflow (.github/workflows/codspeed.yml): Runs benchmarks in simulation mode on every push to main and on pull requests, using OIDC authentication. Follows the existing pinning strategy (commit hashes with version comments).

Dependencies: Added pytest-codspeed to the dev dependency group.

README: Added CodSpeed badge.

Next steps

  • Once this PR is merged and the workflow runs on main, CodSpeed will start tracking performance and reporting regressions on future pull requests.
  • To run benchmarks locally: uv run codspeed run -m simulation -- pytest tests/benchmarks/ --codspeed
  • Additional benchmarks can be added to tests/benchmarks/ following the same benchmark fixture pattern.

name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@codspeed-hq
Copy link
Copy Markdown
Author

codspeed-hq Bot commented May 16, 2026

Congrats! CodSpeed is installed 🎉

🆕 31 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Open in CodSpeed

@codspeed-hq codspeed-hq Bot marked this pull request as ready for review May 16, 2026 16:33
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