Skip to content

Commit 17d3f49

Browse files
committed
Run simple benchmarks as part of CI.
1 parent 4a02f3f commit 17d3f49

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.github/workflows/ci.yml

+10
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ jobs:
140140
path: dist/*.whl
141141
if-no-files-found: ignore
142142

143+
- name: Running benchmark
144+
run: |
145+
python benchmark/telco_fractions.py
146+
python benchmark/microbench.py create pydigits
147+
143148
non-Linux:
144149
strategy:
145150
# Allows for matrix sub-jobs to fail without canceling the rest
@@ -193,3 +198,8 @@ jobs:
193198
name: wheels-${{ matrix.os }}
194199
path: dist/*.whl
195200
if-no-files-found: ignore
201+
202+
- name: Running benchmark
203+
run: |
204+
python benchmark/telco_fractions.py
205+
python benchmark/microbench.py create pydigits

benchmark/microbench.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import datetime
22
import itertools
33
import operator
4+
import os
45
import statistics
56
import timeit
67
from collections import defaultdict
78

89
from decimal import Decimal
910
from fractions import Fraction as PyFraction
10-
from quicktions import Fraction as QFraction
11+
12+
def rel_path(*path):
13+
return os.path.join(os.path.dirname(__file__), *path)
14+
15+
try:
16+
from quicktions import Fraction as QFraction
17+
except ImportError:
18+
import sys
19+
sys.path.insert(0, rel_path('..', 'src'))
20+
from quicktions import Fraction as QFraction
1121

1222
PyFraction.__name__ = "PyFraction"
1323

0 commit comments

Comments
 (0)