Skip to content

Commit 84bb2ac

Browse files
Make text-icu benchmark optional via flag
1 parent 93ff334 commit 84bb2ac

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

benchmark/Benchmark.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import Control.DeepSeq (NFData)
1717
import Criterion.Main (Benchmark, bench, bgroup, defaultMain, nf)
1818
import Data.Text (Text)
1919
import qualified Data.Text as T
20+
#ifdef BENCH_ICU
2021
import qualified Data.Text.ICU as TI
22+
#endif
2123
import qualified Data.Text.Normalize as UT
2224
import Path (Dir, Path, Rel, mkRelDir, toFilePath,
2325
(</>))
@@ -26,8 +28,12 @@ import System.FilePath (dropExtensions, takeFileName)
2628

2729
implementations :: [(String, Text -> Text)]
2830
implementations =
29-
[ ("text-icu" , TI.normalize TI.NFD)
30-
, ("unicode-transforms" , UT.normalize UT.NFD)
31+
[
32+
#ifdef BENCH_ICU
33+
("text-icu" , TI.normalize TI.NFD)
34+
,
35+
#endif
36+
("unicode-transforms" , UT.normalize UT.NFD)
3137
]
3238

3339
dataDir :: Path Rel Dir

unicode-transforms.cabal

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ extra-source-files:
3838
unicode-data/README.md
3939
unicode-data/ucd/NormalizationTest.txt
4040

41+
flag bench-icu
42+
description: Use text-icu for benchmark comparison
43+
manual: True
44+
default: False
45+
4146
library
4247
default-language: Haskell98
4348
ghc-options: -Wall
@@ -95,8 +100,11 @@ Benchmark bench
95100
, path
96101
, path-io
97102
, text
98-
, text-icu >= 0.6.2.1
99103
, unicode-transforms
104+
if flag(bench-icu)
105+
cpp-options: -DBENCH_ICU
106+
build-depends:
107+
text-icu >= 0.6.2.1
100108

101109
source-repository head
102110
type: git

0 commit comments

Comments
 (0)