Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CodSpeed

# Continuous performance regression tracking for redis-om-python.
#
# Runs the benchmark suite under CodSpeed's walltime instrument on every
# Runs the benchmark suite under CodSpeed's CPU simulation instrument on every
# push to main and every pull request. Results are uploaded to CodSpeed,
# which compares them against the baseline and posts a comment on PRs when
# a regression is detected.
Expand Down Expand Up @@ -69,5 +69,5 @@ jobs:
- name: Run benchmarks
uses: CodSpeedHQ/action@v4
with:
mode: walltime
mode: simulation
run: uv run pytest tests/test_performance_benchmark.py --codspeed -v
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[![License][license-image]][license-url]
[![Build Status][ci-svg]][ci-url]
[![Codecov][codecov-svg]][codecov-url]
[![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/XChikuX/redis-om-python?utm_source=badge)

**Redis OM Python** makes it easy to model Redis data in your Python applications.

Expand Down
15 changes: 12 additions & 3 deletions tests/test_performance_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ async def test_bench_hash_all_pks(hash_models):
pks = [pk async for pk in await m.SimpleHash.all_pks(count=100)]
elapsed = time.perf_counter() - start
record_benchmark("hash_all_pks_count_100", elapsed, ops=len(pks))
assert len(pks) == 200
# CodSpeed re-runs the benchmark body multiple times against the same
# fixture, so records accumulate across invocations; assert at least the
# 200 saved by this run rather than an exact count.
assert len(pks) >= 200


@py_test_mark_asyncio
Expand Down Expand Up @@ -620,7 +623,10 @@ async def test_bench_json_all_pks(json_models):
pks = [pk async for pk in await m.SimpleJson.all_pks(count=100)]
elapsed = time.perf_counter() - start
record_benchmark("json_all_pks_count_100", elapsed, ops=len(pks))
assert len(pks) == 200
# CodSpeed re-runs the benchmark body multiple times against the same
# fixture, so records accumulate across invocations; assert at least the
# 200 saved by this run rather than an exact count.
assert len(pks) >= 200


@py_test_mark_asyncio
Expand Down Expand Up @@ -921,7 +927,10 @@ async def test_bench_geo_json_large_radius(json_models):
).all()
elapsed = time.perf_counter() - start
record_benchmark("geo_json_5000km_us", elapsed, ops=len(results))
assert len(results) == 10
# A 5000km radius covers the whole US, so all 10 cities are returned.
# CodSpeed re-runs the body multiple times against the same fixture, so
# cities accumulate across invocations; assert at least the full set.
assert len(results) >= 10


# ══════════════════════════════════════════════════════════════════════
Expand Down
Loading