File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 6666 run : |
6767 python -m pip install --upgrade pip
6868 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
69+ - name : Setup an updatable cache for Performance Baselines
70+ uses : actions/cache@v3
71+ with :
72+ path : .perf.baseline
73+ key : ${{ runner.os }}-performance-${{ hashFiles('tests/test_benchmark.py') }}
74+ restore-keys : ${{ runner.os }}-performance-
6975 - name : Run benchmark
7076 run : pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
7177 - name : Render benchmark result
Original file line number Diff line number Diff line change @@ -58,4 +58,5 @@ docs/_build/
5858tests /config.json
5959
6060
61- .env
61+ .env
62+ .perf.baseline
Original file line number Diff line number Diff line change 1- .
2- python-dotenv
3- pytest-benchmark
1+ -e .
2+
3+ # python-dotenv 1.0+ no longer supports Python 3.7
4+ python-dotenv >= 0.21 ,< 2
5+
6+ pytest-benchmark >= 4 ,< 5
7+ perf_baseline >= 0.1 ,< 0.2
8+
Original file line number Diff line number Diff line change 11from tests .simulator import ClientCredentialGrantSimulator as CcaTester
2+ from perf_baseline import Baseline
3+
4+
5+ baseline = Baseline (".perf.baseline" , threshold = 1.5 ) # Up to 1.5x slower than baseline
26
37# Here come benchmark test cases, powered by pytest-benchmark
48# Func names will become diag names.
59def test_cca_1_tenant_with_10_tokens_per_tenant_and_cache_hit (benchmark ):
610 tester = CcaTester (tokens_per_tenant = 10 , cache_hit = True )
11+ baseline .set_or_compare (tester .run )
712 benchmark (tester .run )
813
914def test_cca_many_tenants_with_10_tokens_per_tenant_and_cache_hit (benchmark ):
1015 tester = CcaTester (number_of_tenants = 1000 , tokens_per_tenant = 10 , cache_hit = True )
16+ baseline .set_or_compare (tester .run )
1117 benchmark (tester .run )
1218
1319def test_cca_1_tenant_with_10_tokens_per_tenant_and_cache_miss (benchmark ):
1420 tester = CcaTester (tokens_per_tenant = 10 , cache_hit = False )
21+ baseline .set_or_compare (tester .run )
1522 benchmark (tester .run )
1623
1724def test_cca_many_tenants_with_10_tokens_per_tenant_and_cache_miss (benchmark ):
1825 tester = CcaTester (number_of_tenants = 1000 , tokens_per_tenant = 10 , cache_hit = False )
26+ baseline .set_or_compare (tester .run )
1927 benchmark (tester .run )
2028
You can’t perform that action at this time.
0 commit comments