Skip to content

Commit d155e79

Browse files
authored
Switch benchmarks to tasty-bench (#213)
* Switch benchmarks to tasty-bench * Regenerate CI config * Fix compilation of LargeOutput under GHC 7.4 * Fix no-text 7.10 build * Add a comment about build-depends: ghc-prim
1 parent e4a7f28 commit d155e79

9 files changed

Lines changed: 17 additions & 18 deletions

File tree

.github/workflows/haskell-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
140140
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
141141
if [ $((HCNUMVER >= 80000 && HCNUMVER < 90200)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" ; else echo "ARG_TESTS=--disable-tests" >> "$GITHUB_ENV" ; fi
142-
if [ $((HCNUMVER >= 70800 && HCNUMVER < 90200)) -ne 0 ] ; then echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" ; else echo "ARG_BENCH=--disable-benchmarks" >> "$GITHUB_ENV" ; fi
142+
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
143143
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
144144
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
145145
echo "GHCJSARITH=0" >> "$GITHUB_ENV"

.github/workflows/no-text.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ jobs:
3333
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
3434
key: ${{ runner.os }}-${{ matrix.ghc }}
3535
- name: Build
36-
run: cabal build -f-text prettyprinter:prettyprinter
36+
# There are linking error when building hashable, see #212.
37+
run: cabal build -f-text --constraint 'semigroups -hashable' prettyprinter:prettyprinter

cabal.haskell-ci

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
-- build only master branch, or PRs to master branch
55
branches: master
66

7-
-- gauge works only with newer GHC
8-
9-
-- FIXME: Enable benchmarks for GHC 9.2 once basement (via gauge) is compatible:
10-
-- https://github.com/haskell-foundation/foundation/issues/554
11-
benchmarks: >=7.8.4 && <9.2
12-
137
-- Doctests fail with GHC 7.10
148

159
-- FIXME: Enable tests for GHC 9.2 once doctest is compatible:

prettyprinter-ansi-terminal/bench/LargeOutput.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE DeriveGeneric #-}
2-
{-# LANGUAGE LambdaCase #-}
32
{-# LANGUAGE OverloadedStrings #-}
43

54
{-# OPTIONS_GHC -fno-warn-orphans #-}
@@ -19,14 +18,14 @@ import Data.Text (Text)
1918
import qualified Data.Text as T
2019
import qualified Data.Text.IO as T
2120
import qualified Data.Text.Lazy as TL
22-
import Gauge
2321
import GHC.Generics
2422
import Prettyprinter
2523
import Prettyprinter.Render.Terminal as Terminal
2624
import qualified Prettyprinter.Render.Text as Text
2725
import Test.QuickCheck
2826
import Test.QuickCheck.Gen
2927
import Test.QuickCheck.Random
28+
import Test.Tasty.Bench
3029

3130

3231

@@ -103,7 +102,7 @@ prettyLambdaForm (LambdaForm free bound body) = prettyExp . (<+> anCol Blue "->"
103102
prettyExp = (<+> prettyExpr body)
104103

105104
prettyExpr :: Expr -> Doc AnsiStyle
106-
prettyExpr = \case
105+
prettyExpr = \expr -> case expr of
107106
Let binds body ->
108107
align (vsep [ anCol Red "let" <+> align (prettyBinds binds)
109108
, anCol Red "in" <+> prettyExpr body ])

prettyprinter-ansi-terminal/prettyprinter-ansi-terminal.cabal

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ benchmark large-output
6464
, base-compat >=0.9.3 && <0.12
6565
, containers
6666
, deepseq
67-
, gauge >= 0.2
67+
, tasty-bench >= 0.2
6868
, prettyprinter
6969
, prettyprinter-ansi-terminal
7070
, QuickCheck >= 2.7
@@ -75,3 +75,7 @@ benchmark large-output
7575
ghc-options: -O2 -rtsopts -Wall
7676
default-language: Haskell2010
7777
type: exitcode-stdio-1.0
78+
79+
-- For GHC.Generics
80+
if !impl(ghc >= 7.6)
81+
build-depends: ghc-prim

prettyprinter/bench/FasterUnsafeText.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ module Main (main) where
44

55

66

7-
import Gauge.Main
87
import Data.Char
98
import Data.Text (Text)
109
import qualified Data.Text as T
1110
import Prettyprinter.Internal
11+
import Test.Tasty.Bench
1212

1313

1414

prettyprinter/bench/Fusion.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ module Main (main) where
99

1010
import Control.Monad
1111
import Control.Monad.State
12-
import Gauge.Main
1312
import Data.Text (Text)
1413
import qualified Data.Text as T
1514
import System.Random
15+
import Test.Tasty.Bench
1616

1717
import Prettyprinter
1818
import Prettyprinter.Render.Text

prettyprinter/bench/LargeOutput.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Prelude.Compat
1010

1111
import Control.DeepSeq
1212
import Control.Monad.Compat
13-
import Gauge
1413
import Data.Char
1514
import Data.Map (Map)
1615
import qualified Data.Map as M
@@ -24,6 +23,7 @@ import GHC.Generics
2423
import Test.QuickCheck
2524
import Test.QuickCheck.Gen
2625
import Test.QuickCheck.Random
26+
import Test.Tasty.Bench
2727
import qualified Text.PrettyPrint.ANSI.Leijen as WL
2828

2929

prettyprinter/prettyprinter.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ benchmark fusion
177177
base >= 4.5 && < 5
178178
, prettyprinter
179179

180-
, gauge >= 0.2
180+
, tasty-bench >= 0.2
181181
, mtl >= 2.1
182182
, random >= 1.0
183183
, text
@@ -195,7 +195,7 @@ benchmark faster-unsafe-text
195195
base >= 4.5 && < 5
196196
, prettyprinter
197197

198-
, gauge >= 0.2
198+
, tasty-bench >= 0.2
199199
, text
200200

201201
hs-source-dirs: bench
@@ -214,7 +214,7 @@ benchmark large-output
214214
, prettyprinter
215215
, ansi-wl-pprint
216216

217-
, gauge >= 0.2
217+
, tasty-bench >= 0.2
218218
, QuickCheck >= 2.7
219219
, containers
220220
, text
@@ -226,6 +226,7 @@ benchmark large-output
226226
default-language: Haskell2010
227227
type: exitcode-stdio-1.0
228228

229+
-- For GHC.Generics
229230
if !impl(ghc >= 7.6)
230231
build-depends: ghc-prim
231232

0 commit comments

Comments
 (0)