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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
{-# LANGUAGE CPP #-}
module Unicode.Char.CaseBench
( benchmarks
) where
import Test.Tasty.Bench (Benchmark)
import Unicode.Char.Bench (
Bench (..),
CharRange,
bgroupWithCharRange,
bgroupWithChars,
)
import qualified Unicode.Char.Case as C
#if MIN_VERSION_base(4,18,0)
import qualified Data.Char as Char
#endif
{-# NOINLINE benchmarks #-}
benchmarks :: CharRange -> Benchmark
benchmarks r = bgroupWithCharRange "Unicode.Char.Case" r $ \chars ->
[
#if MIN_VERSION_base(4,18,0)
bgroupWithChars "isLowerCase" chars
[ Bench "base" Char.isLowerCase
, Bench "unicode-data" C.isLowerCase
]
, bgroupWithChars "isUpperCase" chars
[ Bench "base" Char.isUpperCase
, Bench "unicode-data" C.isUpperCase
]
#else
bgroupWithChars "isLowerCase" chars
[ Bench "unicode-data" C.isLowerCase
]
, bgroupWithChars "isUpperCase" chars
[ Bench "unicode-data" C.isUpperCase
]
#endif
, bgroupWithChars "toCaseFoldString" chars
[ Bench "unicode-data" C.toCaseFoldString
]
, bgroupWithChars "toLowerString" chars
[ Bench "unicode-data" C.toLowerString
]
, bgroupWithChars "toTitleString" chars
[ Bench "unicode-data" C.toTitleString
]
, bgroupWithChars "toUpperString" chars
[ Bench "unicode-data" C.toUpperString
]
]
|