-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement performance benchmarking (#443)
* feat: Implement performance benchmarking * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b753500
commit 92cf2c0
Showing
17 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: codspeed-benchmarks | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" # or "master" | ||
pull_request: | ||
# `workflow_dispatch` allows CodSpeed to trigger backtest | ||
# performance analysis in order to generate initial data. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
benchmarks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.7" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r robyn/test-requirements.txt | ||
- name: Add macos target | ||
if: matrix.os == 'macos' | ||
run: rustup target add aarch64-apple-darwin | ||
- name: Setup Rust part of the project | ||
run: | | ||
maturin build -i python --universal2 --out dist | ||
pip install --no-index --find-links=dist/ robyn | ||
- name: Run benchmarks | ||
uses: CodSpeedHQ/action@v1 | ||
with: | ||
token: ${{ secrets.CODSPEED_TOKEN }} | ||
run: pytest integration_tests --codspeed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,50 @@ | ||
from helpers.http_methods_helpers import get, post | ||
import pytest | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_get_sync_view(session): | ||
r = get("/sync/view") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_post_sync_view(session): | ||
r = post("/sync/view", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_get_sync_decorator_view(session): | ||
r = get("/sync/view/decorator") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_post_sync_decorator_view(session): | ||
r = post("/sync/view/decorator", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_get_async_view(session): | ||
r = get("/async/view") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_post_async_view(session): | ||
r = post("/async/view", data={"name": "John"}) | ||
assert "John" in r.text | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_get_async_decorator_view(session): | ||
r = get("/async/view/decorator") | ||
assert r.text == "Hello, world!" | ||
|
||
|
||
@pytest.mark.benchmark | ||
def test_post_async_decorator_view(session): | ||
r = post("/async/view/decorator", data={"name": "John"}) | ||
assert "John" in r.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
requests==2.28.2 | ||
pytest==7.2.1 | ||
websocket-client==1.5.0 | ||
pytest-codspeed |