File: NumericBench.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 (37 lines) | stat: -rw-r--r-- 1,096 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
33
34
35
36
37
module Unicode.Char.NumericBench
    ( benchmarks
    ) where

import Data.Int (Int64)
import Test.Tasty.Bench (Benchmark, bgroup)

import Unicode.Char.Bench (
    Bench (..),
    CharRange,
    bgroupWithCharRange,
    bgroupWithChars,
 )
import qualified Unicode.Char.Numeric as Num

{-# NOINLINE benchmarks #-}
benchmarks :: CharRange -> Benchmark
benchmarks r = bgroupWithCharRange "Unicode.Char.Numeric" r $ \chars ->
  -- [TODO] Replace with 'isNumber' once the migration is done.
  [ bgroupWithChars "isNumeric" chars
    [ Bench "unicode-data" Num.isNumeric
    ]
  , bgroupWithChars "numericValue" chars
    [ Bench "unicode-data" Num.numericValue
    ]
  , bgroup "integerValue"
        [ bgroupWithChars "Integer" chars
            [ Bench "unicode-data" (Num.integerValue :: Char -> Maybe Integer)
            ]
        , bgroupWithChars "Int64" chars
            [ Bench "unicode-data" (Num.integerValue :: Char -> Maybe Int64)
            ]
        , bgroupWithChars "Int" chars
            [ Bench "unicode-data" (Num.integerValue :: Char -> Maybe Int)
            ]
        ]
  ]