Skip to content

Add CodSpeed performance benchmarks - #253

Merged
BradyAJohnston merged 1 commit into
mainfrom
codspeed/setup-benchmarks
Oct 8, 2026
Merged

BradyAJohnston merged 1 commit into
mainfrom
codspeed/setup-benchmarks

Conversation

@codspeed

@codspeed codspeed Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This PR sets up continuous performance tracking with CodSpeed using pytest-codspeed.

What's included

Benchmarks (benchmarks/, 15 in total, run against a real bpy in CPU simulation mode):

  • test_bench_builder.py: building trees with the builder API. Covers the README example (with and without the Sugiyama arrange step), a 4-bit boolean decoder made of many BooleanMath nodes, a long chain of math operator expressions, and a small shader tree.
  • test_bench_layout.py: nodebpy.arrange on pre-built trees, using both the sugiyama and simple methods. The tree is built outside the measured region, so only the layout work is timed.
  • test_bench_codegen.py: to_python() export (with format=False so ruff isn't part of the measurement) for each sample tree, plus running the generated code to rebuild the tree.

The benchmarks have their own conftest.py. It reloads tests/data/test_startup.blend before each benchmark and skips the save-to-.blend teardown that the test suite does.

CI: .github/workflows/codspeed.yml runs uv run pytest benchmarks/ --codspeed through CodSpeedHQ/action@v5 in simulation mode on ubuntu-latest. It triggers on pushes to main, on pull requests, and on workflow_dispatch, and authenticates with OIDC, so no token secret is needed.

Other changes: added pytest-codspeed to the dev dependency group (uv.lock is updated) and added a CodSpeed badge to the README.

Running locally

uv sync --all-extras
uv run pytest benchmarks/            # quick run as ordinary tests
uv run pytest benchmarks/ --codspeed # benchmark mode

Next steps

  • Once this is merged, CodSpeed will record a baseline on main and post performance reports on later pull requests.
  • The Sugiyama layout benchmarks are the slowest ones and the most useful for spotting layout regressions. More trees from tests/layout/corpus can be added if you want broader layout coverage.

@codspeed

codspeed Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Congrats! CodSpeed is installed 🎉

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

@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.30%. Comparing base (107ed3c) to head (8e567d4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #253   +/-   ##
=======================================
  Coverage   98.30%   98.30%           
=======================================
  Files         101      101           
  Lines       30574    30574           
=======================================
  Hits        30056    30056           
  Misses        518      518           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BradyAJohnston
BradyAJohnston marked this pull request as ready for review October 8, 2026 16:33
@BradyAJohnston
BradyAJohnston merged commit 565b7c6 into main Oct 8, 2026
11 checks passed
@BradyAJohnston
BradyAJohnston deleted the codspeed/setup-benchmarks branch October 8, 2026 16:33
@codspeed
codspeed Bot requested a review from BradyAJohnston October 8, 2026 16:39
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.

2 participants