Skip to content

Commit

Permalink
add perf test
Browse files Browse the repository at this point in the history
  • Loading branch information
LaihoE committed Dec 9, 2023
1 parent ba9a1c4 commit 9b7b95e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/perftest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
pull_request_target:
branches:
- main

jobs:
test-py:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Setup Python and Run Tests
working-directory: ./src/python
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install pytest maturin patchelf
unzip tests/test_demo.zip
maturin develop --release
python3 test_perf.py
14 changes: 14 additions & 0 deletions src/python/test_perf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from demoparser2 import DemoParser
import time

parser = DemoParser("test.dem")

before = time.time()
for _ in range(10):
event_df = parser.parse_event("player_death", player=["X", "Y"], other=["total_rounds_played"])
print("events took:", time.time() - before)

before = time.time()
for _ in range(10):
ticks_df = parser.parse_ticks(["X", "Y"])
print("ticks took:",time.time() - before)

0 comments on commit 9b7b95e

Please sign in to comment.