Skip to content

Commit 3df6a51

Browse files
committed
Merge branch 'main' of github.com:bbelderbos/bobcodesit
2 parents 6bde9c1 + 229593d commit 3df6a51

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ This file gets generated by [this script](index.py).
336336

337337
- [Pep 723 inline script metadata](notes/20251218125432.md)
338338

339+
## Performance
340+
341+
- [Reliable ci benchmarks with pytest-codspeed](notes/20260128144037.md)
342+
339343
## Plotext
340344

341345
- [Make a terminal plot](notes/20240119105430.md)

notes/20260128144037.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Reliable CI Benchmarks with pytest-codspeed
2+
3+
Traditional CI benchmarks are noisy (10-30% variance) because they measure wall-clock time. CodSpeed uses CPU instruction simulation instead, giving you <1% variance—so you can actually trust the results.
4+
5+
```python
6+
import pytest
7+
8+
@pytest.mark.benchmark
9+
def test_my_algorithm(benchmark):
10+
data = list(range(1000))
11+
result = benchmark(my_algorithm, data)
12+
assert result is not None
13+
```
14+
15+
Run locally with `pytest` (wall-clock), in CI with `pytest --codspeed` (CPU simulation). The `--codspeed` flag only works in their CI environment—that's by design.
16+
17+
Gotcha: push to `main` first to establish a baseline before creating PRs.
18+
19+
#performance #ci #pytest

0 commit comments

Comments
 (0)