Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Summpot committed Nov 10, 2024
1 parent bd9cc60 commit 67f8474
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ jobs:
uses: astral-sh/setup-uv@v3
- name: Build with hatch
run: uv build
- name: Run benchmarks
run: uv run pytest --benchmark-json=results.json
- name: Upload benchmark data
- name: Run benchmark and upload data
run: |
bencher run \
--project image-interpolation \
Expand All @@ -40,3 +38,4 @@ jobs:
--token '${{ secrets.BENCHER_API_TOKEN }}'
--testbed ubuntu-latest \
--github-actions '${{ secrets.GITHUB_TOKEN }}'
"uv run pytest --benchmark-json=results.json"
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts = --benchmark-autosave --benchmark-min-rounds=20 --benchmark-json=result.json
addopts = --benchmark-autosave --benchmark-min-rounds=20
2 changes: 0 additions & 2 deletions src/tests/test_fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ def fibonacci_pure_python(n, computed={0: 0, 1: 1}):

@pytest.mark.parametrize("n", [10, 20, 100, 500, 1000])
def test_fibonacci_pure_python(benchmark, n):
# 基准测试动态规划实现
result = benchmark(fibonacci_pure_python, n)
assert result >= 0

@pytest.mark.parametrize("n", [10, 20, 100, 500, 1000])
def test_fibonacci_pyo3(benchmark, n):
# 基准测试动态规划实现
result = benchmark(image_interpolation.fibonacci, n)
assert result >= 0

0 comments on commit 67f8474

Please sign in to comment.