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