Skip to content

Commit f84b7cb

Browse files
committed
Add basic bench for comparing regressions
1 parent e9c26eb commit f84b7cb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

spago.dhall

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ You can edit this file as you like.
1212
, "foldable-traversable"
1313
, "lists"
1414
, "maybe"
15+
, "minibench"
1516
, "node-child-process"
1617
, "node-fs-aff"
1718
, "node-process"

test/Bench.purs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Test.Bench where
2+
3+
import Prelude
4+
5+
import Data.Monoid (power)
6+
import Dodo (Doc, align, break, plainText, print, text, textParagraph, twoSpaces)
7+
import Effect (Effect)
8+
import Performance.Minibench (benchWith)
9+
10+
test :: forall a. Doc a
11+
test = point latin <> break
12+
where
13+
point = append (text "* ") <<< align 2 <<< textParagraph
14+
latin =
15+
"""
16+
Quisque finibus tellus non molestie porta. In non posuere metus, vitae
17+
tincidunt enim. Nam quis elit pharetra, elementum elit lacinia, efficitur
18+
nibh. Cras lobortis neque sed ante ornare rutrum. Maecenas sed urna nisl.
19+
Phasellus aliquam finibus ex vitae iaculis. Vestibulum ante ipsum primis
20+
in faucibus orci luctus et ultrices posuere cubilia curae; Suspendisse
21+
eget tortor eget sapien tincidunt vestibulum eu a velit. Pellentesque eu
22+
tortor ut lectus sodales ornare.
23+
"""
24+
25+
main :: Effect Unit
26+
main = do
27+
benchWith 3000 \_ -> print plainText twoSpaces (power test 10)

0 commit comments

Comments
 (0)