Skip to content

Add CodSpeed performance benchmarks#1

Merged
ser merged 1 commit intomainfrom
codspeed-wizard-1776517053055
Apr 18, 2026
Merged

Add CodSpeed performance benchmarks#1
ser merged 1 commit intomainfrom
codspeed-wizard-1776517053055

Conversation

@codspeed-hq
Copy link
Copy Markdown
Contributor

@codspeed-hq codspeed-hq Bot commented Apr 18, 2026

Summary

This PR sets up continuous performance benchmarking for tldpy using CodSpeed with pytest-codspeed.

What changed

New dev dependency

  • pytest-codspeed added to the [dependency-groups] dev section of pyproject.toml (lockfile updated accordingly).

Benchmark suite (tests/test_benchmarks.py)

12 benchmarks covering the core view utility functions that handle HTML processing and data lookups:

Function Benchmarks What it measures
decode_content bytes input, string passthrough Content decoding path for S3 responses
extract_title small HTML, large HTML, missing title Regex-based <title> extraction at different document sizes
extract_breadcrumbs small HTML, large HTML Regex-based <h1> extraction for navigation breadcrumbs
get_category_for_key early match, late match, miss Category lookup across the full LDP document index
render_search_results 50 results, empty results HTML generation for the search results page

External services (S3, PostgreSQL) are mocked so benchmarks run in isolation without infrastructure dependencies.

CI workflow (.github/workflows/codspeed.yml)

  • Triggers on pushes to main, pull requests, and workflow_dispatch (for CodSpeed backtesting).
  • Uses OIDC authentication (no token needed).
  • Runs in simulation mode for deterministic, low-variance measurements.
  • Sets up Python 3.14 via uv to match the project requirements.

README

  • Added CodSpeed performance badge.

Next steps

  • Once this PR is merged, CodSpeed will start tracking performance on every push to main and on pull requests.
  • To add more benchmarks, create new test_bench_* functions in tests/test_benchmarks.py using the benchmark fixture.
  • Visit the CodSpeed dashboard to view results and configure performance checks.

@codspeed-hq
Copy link
Copy Markdown
Contributor Author

codspeed-hq Bot commented Apr 18, 2026

Congrats! CodSpeed is installed 🎉

🆕 12 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


Open in CodSpeed

@codspeed-hq codspeed-hq Bot marked this pull request as ready for review April 18, 2026 13:03
@ser ser merged commit aa18330 into main Apr 18, 2026
2 checks passed
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