File: BlocksBench.hs

package info (click to toggle)
haskell-unicode-data 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,004 kB
  • sloc: haskell: 26,075; makefile: 3
file content (32 lines) | stat: -rw-r--r-- 851 bytes parent folder | download
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
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Unicode.Char.General.BlocksBench
    ( benchmarks
    ) where

import Control.DeepSeq (NFData (..))
import Test.Tasty.Bench (Benchmark, bgroup)

import Unicode.Char.Bench (
    Bench (..),
    CharRange (..),
    benchRange,
    bgroupWithCharRange',
 )
import qualified Unicode.Char.General.Blocks as B
import GHC.Generics (Generic)

-- FIXME derive Generic at datatype definition
deriving instance Generic B.BlockDefinition
instance NFData B.BlockDefinition

{-# NOINLINE benchmarks #-}
benchmarks :: CharRange -> Benchmark
benchmarks r = bgroup "Unicode.Char.General.Blocks"
    [ bgroupWithCharRange' "block" r
      [ Bench "unicode-data" (fmap fromEnum . B.block)
      ]
    , bgroup "blockDefinition"
      [ benchRange "unicode-data" B.blockDefinition
      ]
    ]