]> git.immae.eu Git - github/fretlink/blazeT.git/blob - src/Benchmarks/bigtable/hamlet.hs
Initial
[github/fretlink/blazeT.git] / src / Benchmarks / bigtable / hamlet.hs
1 -- | BigTable benchmark implemented using Hamlet.
2 --
3 {-# LANGUAGE QuasiQuotes #-}
4 module Main where
5
6 import Criterion.Main
7 import Text.Hamlet
8 import Text.Hamlet.Monad
9 import Numeric (showInt)
10 import Data.Text (Text)
11 import qualified Data.Text as T
12 import Data.Maybe (fromJust)
13
14 main = 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
25 bigTable 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 ""