Skip to content

Commit

Permalink
Run simple benchmarks as part of CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Feb 18, 2024
1 parent 4a02f3f commit 17d3f49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ jobs:
path: dist/*.whl
if-no-files-found: ignore

- name: Running benchmark
run: |
python benchmark/telco_fractions.py
python benchmark/microbench.py create pydigits
non-Linux:
strategy:
# Allows for matrix sub-jobs to fail without canceling the rest
Expand Down Expand Up @@ -193,3 +198,8 @@ jobs:
name: wheels-${{ matrix.os }}
path: dist/*.whl
if-no-files-found: ignore

- name: Running benchmark
run: |
python benchmark/telco_fractions.py
python benchmark/microbench.py create pydigits
12 changes: 11 additions & 1 deletion benchmark/microbench.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import datetime
import itertools
import operator
import os
import statistics
import timeit
from collections import defaultdict

from decimal import Decimal
from fractions import Fraction as PyFraction
from quicktions import Fraction as QFraction

def rel_path(*path):
return os.path.join(os.path.dirname(__file__), *path)

try:
from quicktions import Fraction as QFraction
except ImportError:
import sys
sys.path.insert(0, rel_path('..', 'src'))
from quicktions import Fraction as QFraction

PyFraction.__name__ = "PyFraction"

Expand Down

0 comments on commit 17d3f49

Please sign in to comment.