Skip to content

Commit

Permalink
Add crude benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
erikkemperman committed Mar 1, 2019
1 parent a0bc447 commit 40b7b95
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ pip-log.txt
.tox
nosetests.xml
coverage.xml
.mypy_cache
.pytest_cache

# Virtual env
venv

# Translations
*.mo
Expand All @@ -51,8 +56,6 @@ TestResults/Rx.TE.Tests.mdf
TestResults/Rx.TE.Tests_log.ldf
*.user

.mypy_cache

# Cloud9
.c9

Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ install:

script:
- python3 setup.py test

after_success:
- ./.travis/bench.sh
35 changes: 35 additions & 0 deletions .travis/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

testargs="--cache-clear --ignore=tests/test_concurrency"
rounds=8

head=$(git status | head -n 1 | grep -o "[^ ]*$")

git remote add upstream https://github.com/erikkemperman/RxPY.git
git fetch upstream master

for branch in "upstream/master" "$head"
do
echo ""
git checkout $branch
echo ""
echo "On branch $branch ..."

sum=0
for round in $(seq $rounds)
do
sec=$(pytest $testargs | grep -o "passed in .* s")
ret=$?

echo -n " - Round $round of $rounds | $sec"
sec=$(echo $sec | sed -e "s/[^0-9]//g")
sum=$(($sum + $sec))
avg=$((($sum * 10) / $round))
avg=$((($avg + 5) / 10))
echo -n " | total $(echo $sum | sed -e "s/\([0-9]\{2\}\)$/.\1/") s"
echo -n " | average $(echo $avg | sed -e "s/\([0-9]\{2\}\)$/.\1/") s"

if [[ $ret == 0 ]]; then echo " | OK"; else echo " | FAIL"; fi
done
done

0 comments on commit 40b7b95

Please sign in to comment.