blob: 2778f2dc8b5c2f715aa8473a01b7d2feb9496568 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
-- | BigTable benchmark implemented using Hamlet.
--
{-# LANGUAGE QuasiQuotes #-}
module Main where
import Criterion.Main
import Text.Hamlet
import Text.Hamlet.Monad
import Numeric (showInt)
import Data.Text (Text)
import qualified Data.Text as T
import Data.Maybe (fromJust)
main = defaultMain
[ bench "bigTable" $ nf bigTable bigTableData
]
where
rows :: Int
rows = 1000
bigTableData :: [[Int]]
bigTableData = replicate rows [1..10]
{-# NOINLINE bigTableData #-}
bigTable rows = fromJust $ hamletToText undefined [$hamlet|
%table
$forall rows row
%tr
$forall row cell
%td $showInt'.cell$
|]
where
showInt' i = Encoded $ T.pack $ showInt i ""
|