aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Benchmarks/bigtable/hamlet.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Benchmarks/bigtable/hamlet.hs')
-rw-r--r--src/Benchmarks/bigtable/hamlet.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Benchmarks/bigtable/hamlet.hs b/src/Benchmarks/bigtable/hamlet.hs
new file mode 100644
index 0000000..2778f2d
--- /dev/null
+++ b/src/Benchmarks/bigtable/hamlet.hs
@@ -0,0 +1,33 @@
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 ""