Skip to content

Commit 591de2e

Browse files
committed
Use criterion-cmp
I extracted criterion-compare-txt into separate package https://hackage.haskell.org/package/criterion-cmp I found it uselul elsewhere as well, and now as I fixed a alignment issue which bothered me, let have it separately available.
1 parent d7a472d commit 591de2e

File tree

10 files changed

+13
-362
lines changed

10 files changed

+13
-362
lines changed

.github/workflows/z-bench.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ jobs:
125125
run: |
126126
touch cabal.project
127127
echo "packages: $GITHUB_WORKSPACE/source/benchmarks" >> cabal.project
128-
echo "packages: $GITHUB_WORKSPACE/source/criterion-compare-txt" >> cabal.project
129128
cat cabal.project
130129
- name: sdist
131130
run: |
@@ -139,19 +138,14 @@ jobs:
139138
run: |
140139
PKGDIR_aeson_benchmarks="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/aeson-benchmarks-[0-9.]*')"
141140
echo "PKGDIR_aeson_benchmarks=${PKGDIR_aeson_benchmarks}" >> $GITHUB_ENV
142-
PKGDIR_criterion_compare_txt="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/criterion-compare-txt-[0-9.]*')"
143-
echo "PKGDIR_criterion_compare_txt=${PKGDIR_criterion_compare_txt}" >> $GITHUB_ENV
144141
touch cabal.project
145142
touch cabal.project.local
146143
echo "packages: ${PKGDIR_aeson_benchmarks}" >> cabal.project
147-
echo "packages: ${PKGDIR_criterion_compare_txt}" >> cabal.project
148144
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package aeson-benchmarks" >> cabal.project ; fi
149145
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
150-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package criterion-compare-txt" >> cabal.project ; fi
151-
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
152146
cat >> cabal.project <<EOF
153147
EOF
154-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(aeson-benchmarks|criterion-compare-txt)$/; }' >> cabal.project.local
148+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(aeson-benchmarks)$/; }' >> cabal.project.local
155149
cat cabal.project
156150
cat cabal.project.local
157151
- name: dump install plan
@@ -174,7 +168,3 @@ jobs:
174168
- name: build
175169
run: |
176170
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
177-
- name: unconstrained build
178-
run: |
179-
rm -f cabal.project.local
180-
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ Of course before submitting a PR, the following steps are recommended:
9999

100100
### Running benchmarks
101101

102-
You need to install `cabal-plan`:
102+
You need to install `cabal-plan` and `criterion-cmp`:
103103

104104
```
105-
cabal install cabal-plan
105+
cabal install cabal-plan criterion-cmp
106106
```
107107
108108
Then to build benchmarks we use a different project, which builds
@@ -121,13 +121,13 @@ git checkout your-branch
121121
which will output a table like
122122
123123
```
124-
Benchmark master your-branch
125-
Examples/decode/github-issues/lazy 1.77e-3 1.76e-3 -0.68%
126-
Examples/decode/github-issues/strict 1.75e-3 1.69e-3 -3.29%
127-
Examples/decode/jp100/lazy 1.97e-3 1.98e-3 +0.43%
128-
Examples/decode/jp100/strict 1.94e-3 1.96e-3 +1.10%
129-
Examples/decode/twitter100/lazy 1.54e-3 1.59e-3 +2.98%
130-
Examples/decode/twitter100/strict 1.51e-3 1.51e-3 -0.20%
124+
Benchmark master your-branch
125+
Examples/decode/github-issues/lazy 1.77e-3 1.76e-3 -0.68%
126+
Examples/decode/github-issues/strict 1.75e-3 1.69e-3 -3.29%
127+
Examples/decode/jp100/lazy 1.97e-3 1.98e-3 +0.43%
128+
Examples/decode/jp100/strict 1.94e-3 1.96e-3 +1.10%
129+
Examples/decode/twitter100/lazy 1.54e-3 1.59e-3 +2.98%
130+
Examples/decode/twitter100/strict 1.51e-3 1.51e-3 -0.20%
131131
```
132132
133133
Run `./bench.sh help` for more details.

bench.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ cmdBuild() {
108108
# Building
109109
putInfo "Building benchmarks"
110110

111-
command cabal build --project-file cabal.bench.project -w "$HC" aeson-benchmark-suite criterion-compare-txt
111+
command cabal build --project-file cabal.bench.project -w "$HC" aeson-benchmark-suite
112112
}
113113

114114
# run
@@ -197,10 +197,6 @@ cmdCompare() {
197197
esac
198198
done
199199

200-
# Building
201-
putInfo "Building criterion-compare-txt"
202-
command cabal build --project-file cabal.bench.project -w "$HC" criterion-compare-txt
203-
204200
# Comparing th eresults
205201
putInfo "Comparing runs:$RUNS"
206202

@@ -211,7 +207,7 @@ cmdCompare() {
211207
done
212208

213209
# shellcheck disable=SC2086
214-
command "$(cabal-plan list-bin criterion-compare-txt)" $CSV
210+
command "criterion-cmp" $CSV
215211
}
216212

217213
# main

cabal.bench.haskell-ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ github-action-name: Z Bench CI
33
branches: master
44
haddock: False
55
cabal-check: False
6+
unconstrained: False

cabal.bench.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
with-compiler: ghc
22
packages: benchmarks/
3-
packages: criterion-compare-txt/
43
tests: false

criterion-compare-txt/LICENSE

Lines changed: 0 additions & 30 deletions
This file was deleted.

criterion-compare-txt/criterion-compare-txt.cabal

Lines changed: 0 additions & 44 deletions
This file was deleted.

criterion-compare-txt/src/CriterionCompare.hs

Lines changed: 0 additions & 198 deletions
This file was deleted.

0 commit comments

Comments
 (0)