Skip to content

Commit

Permalink
Merge pull request #242 from kpn/feat/bench
Browse files Browse the repository at this point in the history
Feat: Add benchmark
  • Loading branch information
woile authored Nov 21, 2024
2 parents c222b81 + 0b3d40d commit 4015c91
Show file tree
Hide file tree
Showing 10 changed files with 681 additions and 279 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"machine_info": {
"node": "Woile-MacBook-Pro.local",
"processor": "arm",
"machine": "arm64",
"python_compiler": "Clang 16.0.6 ",
"python_implementation": "CPython",
"python_implementation_version": "3.11.10",
"python_version": "3.11.10",
"python_build": [
"main",
"Sep 7 2024 01:03:31"
],
"release": "24.1.0",
"system": "Darwin",
"cpu": {
"python_version": "3.11.10.final.0 (64 bit)",
"cpuinfo_version": [
9,
0,
0
],
"cpuinfo_version_string": "9.0.0",
"arch": "ARM_8",
"bits": 64,
"count": 12,
"arch_string_raw": "arm64",
"brand_raw": "Apple M3 Pro"
}
},
"commit_info": {
"id": "8a7432129b462fb2ee4297789fbd15a3b88b07d1",
"time": "2024-11-20T17:03:56+01:00",
"author_time": "2024-11-19T16:40:26+01:00",
"dirty": true,
"project": "kstreams",
"branch": "(detached head)"
},
"benchmarks": [
{
"group": null,
"name": "test_processing_single_consumer_record",
"fullname": "tests/test_benchmarks.py::test_processing_single_consumer_record",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 4.229199839755893e-05,
"max": 0.0008245829994848464,
"mean": 7.612135620897753e-05,
"stddev": 2.585269375808259e-05,
"rounds": 2673,
"median": 7.541700324509293e-05,
"iqr": 3.001999812113354e-05,
"q1": 5.990650151943555e-05,
"q3": 8.992649964056909e-05,
"iqr_outliers": 17,
"stddev_outliers": 448,
"outliers": "448;17",
"ld15iqr": 4.229199839755893e-05,
"hd15iqr": 0.00013625000065076165,
"ops": 13136.917808645965,
"total": 0.20347238514659693,
"iterations": 1
}
},
{
"group": null,
"name": "test_inject_all",
"fullname": "tests/test_benchmarks.py::test_inject_all",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 4.337500286055729e-05,
"max": 0.021463125001901062,
"mean": 0.0002409296128066245,
"stddev": 0.00032767216641994395,
"rounds": 14954,
"median": 0.00022097950022725854,
"iqr": 0.000182791001861915,
"q1": 0.00013158399815438315,
"q3": 0.00031437500001629815,
"iqr_outliers": 161,
"stddev_outliers": 172,
"outliers": "172;161",
"ld15iqr": 4.337500286055729e-05,
"hd15iqr": 0.000590749998082174,
"ops": 4150.5898272564045,
"total": 3.602861429910263,
"iterations": 1
}
},
{
"group": null,
"name": "test_consume_many",
"fullname": "tests/test_benchmarks.py::test_consume_many",
"params": null,
"param": null,
"extra_info": {},
"options": {
"disable_gc": false,
"timer": "perf_counter",
"min_rounds": 5,
"max_time": 1.0,
"min_time": 5e-06,
"warmup": false
},
"stats": {
"min": 0.0007587500003864989,
"max": 0.0012585000004037283,
"mean": 0.0008135390617422691,
"stddev": 3.9826845749555304e-05,
"rounds": 955,
"median": 0.0008057500017457642,
"iqr": 4.940624876326183e-05,
"q1": 0.0007849169996916316,
"q3": 0.0008343232484548935,
"iqr_outliers": 15,
"stddev_outliers": 215,
"outliers": "215;15",
"ld15iqr": 0.0007587500003864989,
"hd15iqr": 0.00091229100144119,
"ops": 1229.1972777046594,
"total": 0.776929803963867,
"iterations": 1
}
}
],
"datetime": "2024-11-21T13:35:33.270192+00:00",
"version": "5.1.0"
}
53 changes: 53 additions & 0 deletions .github/workflows/bench-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Bump version

on:
push:
branches:
- master

jobs:
bench_release:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Set Cache
uses: actions/cache@v4
id: cache # name for referring later
with:
path: .venv/
# The cache key depends on poetry.lock
key: ${{ runner.os }}-cache-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-cache-
${{ runner.os }}-
- name: Install Dependencies
# if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install -U pip poetry
poetry --version
poetry config --local virtualenvs.in-project true
poetry install
- name: Benchmark code
run: |
./scripts/bench-current
- name: Commit benchmark
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add .benchmarks/
git commit -m "bench: bench: add benchmark current release"
git push origin master
2 changes: 1 addition & 1 deletion .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
bump-version:
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') || !startsWith(github.event.head_commit.message, 'bench:') }}
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pr-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ on:
required: true

jobs:
build:
build_test_bench:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -57,6 +57,10 @@ jobs:
git config --global user.name "GitHub Action"
./scripts/test
- name: Benchmark regression test
run: |
./scripts/bench-compare
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
Expand Down
Loading

0 comments on commit 4015c91

Please sign in to comment.