Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark with app harness #2774

Merged
merged 61 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b8f4e61
Benchmark with app harness
ElijahAhianyo Mar 4, 2024
fdc0595
update matrix
ElijahAhianyo Mar 4, 2024
5d7ef33
switch order
ElijahAhianyo Mar 4, 2024
7169a35
install psycopg2
ElijahAhianyo Mar 4, 2024
d8d2018
modify workflow
ElijahAhianyo Mar 4, 2024
041819b
its psycopg2
ElijahAhianyo Mar 4, 2024
f70a7e3
its psycopg2
ElijahAhianyo Mar 4, 2024
6024425
add install cmd
ElijahAhianyo Mar 4, 2024
d02e50b
python 3.8 type issues
ElijahAhianyo Mar 4, 2024
96280bf
python 3.8 type issues
ElijahAhianyo Mar 4, 2024
39bc088
use codspeed
ElijahAhianyo Mar 5, 2024
69aa25d
poetry run
ElijahAhianyo Mar 5, 2024
533c8ff
fix benchmark workflow syntax
ElijahAhianyo Mar 5, 2024
60738c9
add codspeed deps
ElijahAhianyo Mar 5, 2024
16860c0
manually install codspeed
ElijahAhianyo Mar 5, 2024
d50d7b4
fix test dir path
ElijahAhianyo Mar 5, 2024
0854292
install missing deps
ElijahAhianyo Mar 5, 2024
6e61bb1
use codspeed.yml instead
ElijahAhianyo Mar 5, 2024
7dc6899
poetry setup in CI
ElijahAhianyo Mar 5, 2024
37f0df0
fix test path
ElijahAhianyo Mar 5, 2024
3eb36f2
add test for blank template with two pages
ElijahAhianyo Mar 5, 2024
55827b3
segregation
ElijahAhianyo Mar 5, 2024
c7696eb
remove codspeed.yml
ElijahAhianyo Mar 5, 2024
bf721a6
update
martinxu9 Mar 5, 2024
c7f23cb
fix CI
martinxu9 Mar 6, 2024
bbb1adb
comment, remove empty file
martinxu9 Mar 6, 2024
0c286fc
fix dep in CI again
martinxu9 Mar 6, 2024
3083b08
quotes around args
martinxu9 Mar 6, 2024
dab5db9
fix args passing
martinxu9 Mar 6, 2024
ed31214
fix type anno
martinxu9 Mar 6, 2024
a5a0716
fix args again
martinxu9 Mar 6, 2024
c188dc5
try fixing CI again
martinxu9 Mar 6, 2024
8eff696
oops
martinxu9 Mar 6, 2024
7f1ff30
crawling in fixes
martinxu9 Mar 6, 2024
4945e4a
only run on linux
martinxu9 Mar 6, 2024
f55bb73
rename files
martinxu9 Mar 6, 2024
c7de50d
oops
martinxu9 Mar 6, 2024
42de09a
Merge remote-tracking branch 'origin/main' into elijah/benchmark
martinxu9 Mar 6, 2024
e8458c4
remove fmt change on pyproject
martinxu9 Mar 6, 2024
f783f38
Revert "only run on linux"
martinxu9 Mar 7, 2024
98e994d
try headless
martinxu9 Mar 7, 2024
dc9ccb3
headless in conftest
martinxu9 Mar 7, 2024
ea1bec6
refactor benchmarks to use number metrics
ElijahAhianyo Mar 8, 2024
5ea8cad
run black
ElijahAhianyo Mar 8, 2024
4444702
benchmark tests for varying component number
ElijahAhianyo Mar 8, 2024
2de7287
move benmark to its own folder
martinxu9 Mar 8, 2024
c44ab39
refactor dups
ElijahAhianyo Mar 11, 2024
060a8f3
test reducing number of benchmark rounds
ElijahAhianyo Mar 11, 2024
96b5224
add more output to debug CI hang
ElijahAhianyo Mar 11, 2024
ac70fd3
experiment timeout minutes for windows
ElijahAhianyo Mar 11, 2024
85b71a0
experiment timeout minutes for windows
ElijahAhianyo Mar 11, 2024
86217f5
skip cold tests on windows
ElijahAhianyo Mar 11, 2024
5b20833
fix broken tests
ElijahAhianyo Mar 11, 2024
0d64610
Increase rounds of 1000 pages warm test to 5
ElijahAhianyo Mar 11, 2024
136fc01
precommit fix
ElijahAhianyo Mar 11, 2024
cbe293d
remove old benchmarks
ElijahAhianyo Mar 11, 2024
f4f8a8a
refactor
ElijahAhianyo Mar 11, 2024
16ca965
fixed docstrings
ElijahAhianyo Mar 12, 2024
5715d2e
address comments
ElijahAhianyo Mar 12, 2024
be3d2cb
add branch name and event type
ElijahAhianyo Mar 12, 2024
361ff98
add branch name actor and event type
ElijahAhianyo Mar 12, 2024
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
57 changes: 53 additions & 4 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ env:
PYTHONIOENCODING: 'utf8'
TELEMETRY_ENABLED: false
NODE_OPTIONS: '--max_old_space_size=4096'
DATABASE_URL: ${{ secrets.DATABASE_URL }}

jobs:
reflex-web:
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -70,8 +69,58 @@ jobs:
- name: Run Benchmarks
# Only run if the database creds are available in this context.
if: ${{ env.DATABASE_URL }}
working-directory: ./integration/benchmarks
run: poetry run python benchmarks.py "$GITHUB_SHA" .lighthouseci
run: poetry run python scripts/lighthouse_score_upload.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci
env:
GITHUB_SHA: ${{ github.sha }}
PR_TITLE: ${{ github.event.pull_request.title }}

simple-apps-benchmarks:
env:
OUTPUT_FILE: benchmarks.json
timeout-minutes: 50
strategy:
# Prioritize getting more information out of the workflow (even if something fails)
fail-fast: false
matrix:
# Show OS combos first in GUI
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8.18', '3.9.18', '3.10.13', '3.11.5', '3.12.0']
exclude:
- os: windows-latest
python-version: '3.10.13'
- os: windows-latest
python-version: '3.9.18'
- os: windows-latest
python-version: '3.8.18'
include:
- os: windows-latest
python-version: '3.10.11'
- os: windows-latest
python-version: '3.9.13'
- os: windows-latest
python-version: '3.8.10'

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
- name: Run benchmark tests
env:
APP_HARNESS_HEADLESS: 1
PYTHONUNBUFFERED: 1
run: |
poetry run pytest -v benchmarks/ --benchmark-json=${{ env.OUTPUT_FILE }} -s
- name: Upload benchmark results
# Only run if the database creds are available in this context.
if: ${{ env.DATABASE_URL }}
run: poetry run python scripts/simple_app_benchmark_upload.py --os "${{ matrix.os }}"
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--benchmark-json "${{ env.OUTPUT_FILE }}" --pr-title "${{ github.event.pull_request.title }}"
--db-url "${{ env.DATABASE_URL }}" --branch-name "${{ github.head_ref || github.ref_name }}"
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}"
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: '^integration/benchmarks/'

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.313
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Reflex benchmarks."""

WINDOWS_SKIP_REASON = "Takes too much time as a result of npm"
20 changes: 20 additions & 0 deletions benchmarks/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Shared conftest for all benchmark tests."""

import pytest

from reflex.testing import AppHarness, AppHarnessProd


@pytest.fixture(
scope="session", params=[AppHarness, AppHarnessProd], ids=["dev", "prod"]
)
def app_harness_env(request):
"""Parametrize the AppHarness class to use for the test, either dev or prod.

Args:
request: The pytest fixture request object.

Returns:
The AppHarness class to use for the test.
"""
return request.param
Loading
Loading