Skip to content

Commit

Permalink
ci(benchmark): Benchmark introduction (ydataai#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman authored Apr 7, 2021
1 parent cade480 commit e979665
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 266 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Performance Benchmarks

on:
push:
branches:
- master
- develop

jobs:
benchmark:
name: ${{ matrix.os }} x ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ] #, macos-latest, windows-latest ]
python: ['3.8']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Run benchmark
run: |
pip install -r requirements.txt
pip install -r requirements-test.txt
pytest tests/benchmarks/bench.py --benchmark-json benchmark.json
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Pandas Profiling Benchmarks
tool: 'pytest'
output-file-path: benchmark.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ coverage<5
codecov
pytest-mypy
pytest-cov
pytest-benchmark~=3.2.2
nbval
pyarrow
flake8
Expand Down
74 changes: 74 additions & 0 deletions tests/benchmarks/bench.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import pandas as pd

from pandas_profiling import ProfileReport
from pandas_profiling.utils.cache import cache_file


def test_titanic_explorative(benchmark):
file_name = cache_file(
"titanic.parquet",
"https://github.com/pandas-profiling/pandas-profiling-data/raw/master/data/titanic.parquet",
)

data = pd.read_parquet(file_name)

def func(df):
profile = ProfileReport(
df, title="Titanic Dataset", explorative=True, progress_bar=False
)
report = profile.to_html()
return report

benchmark(func, data)


def test_titanic_default(benchmark):
file_name = cache_file(
"titanic.parquet",
"https://github.com/pandas-profiling/pandas-profiling-data/raw/master/data/titanic.parquet",
)

data = pd.read_parquet(file_name)

def func(df):
profile = ProfileReport(df, title="Titanic Dataset", progress_bar=False)
report = profile.to_html()
return report

benchmark(func, data)


def test_titanic_minimal(benchmark):
file_name = cache_file(
"titanic.parquet",
"https://github.com/pandas-profiling/pandas-profiling-data/raw/master/data/titanic.parquet",
)

data = pd.read_parquet(file_name)

def func(df):
profile = ProfileReport(
df, title="Titanic Dataset", minimal=True, progress_bar=False
)
report = profile.to_html()
return report

benchmark(func, data)


def test_rdw_minimal(benchmark):
file_name = cache_file(
"rdw.parquet",
"https://github.com/pandas-profiling/pandas-profiling-data/raw/master/data/rdw.parquet",
)

data = pd.read_parquet(file_name)

def func(df):
profile = ProfileReport(
df, title="RDW Dataset", minimal=True, progress_bar=False
)
report = profile.to_html()
return report

benchmark(func, data)
25 changes: 0 additions & 25 deletions tests/performance/time_inf.py

This file was deleted.

36 changes: 0 additions & 36 deletions tests/performance/time_kurtosis.py

This file was deleted.

56 changes: 0 additions & 56 deletions tests/performance/time_mad.py

This file was deleted.

36 changes: 0 additions & 36 deletions tests/performance/time_mean.py

This file was deleted.

113 changes: 0 additions & 113 deletions tests/performance/timings.py

This file was deleted.

0 comments on commit e979665

Please sign in to comment.