osqp-python icon indicating copy to clipboard operation
osqp-python copied to clipboard

Add CodSpeed performance benchmarks

Open codspeed[bot] opened this issue 6 months ago • 5 comments

Summary

This PR integrates CodSpeed for continuous performance testing of the OSQP Python solver. It adds a benchmark suite covering the core solver operations and a GitHub Actions workflow that runs these benchmarks on every push to master and on pull requests.

Changes

Benchmark suite (benchmarks/bench_solver.py)

11 benchmarks using pytest-codspeed (compatible with pytest-benchmark API) covering:

  • Setup: Solver initialization across small (n=2), medium (n=50), and large (n=200) QP problems
  • Solve: Solving QP problems at each size
  • Update + solve: Updating linear cost and bounds, then re-solving
  • End-to-end: Full setup and solve cycle (small and medium)
  • Polishing: Solve with the polishing refinement step enabled
  • Warm start: Solve with warm starting from a previous solution

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

  • Runs on push to master, pull requests, and workflow_dispatch (for CodSpeed backtesting)
  • Uses OIDC authentication (no token needed)
  • Builds the C++ extension from source, then runs benchmarks in simulation mode
  • Uses CodSpeedHQ/action@v4

README

  • Added CodSpeed badge

Next steps

Once this PR is merged:

  1. Performance results will be tracked on the CodSpeed dashboard
  2. Pull requests will receive automated performance reports comparing against the base branch
  3. Performance regressions will be flagged before they reach master

codspeed[bot] avatar May 25 '26 18:05 codspeed[bot]

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar May 25 '26 18:05 CLAassistant

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar May 25 '26 18:05 CLAassistant

Congrats! CodSpeed is installed 🎉

🆕 11 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[bot] avatar May 25 '26 18:05 codspeed[bot]

Congrats! CodSpeed is installed 🎉

🆕 11 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[bot] avatar May 25 '26 18:05 codspeed[bot]

Note: This PR is experimental, to test out a benchmarking framework I recently learned of. DO NOT MERGE!

vineetbansal avatar May 25 '26 18:05 vineetbansal