Skip to content

Commit

Permalink
Merge e1dcb66 into 7201989
Browse files Browse the repository at this point in the history
  • Loading branch information
harendra-kumar committed Jul 28, 2020
2 parents 7201989 + e1dcb66 commit 95b0ac1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
47 changes: 47 additions & 0 deletions README.md
Expand Up @@ -25,6 +25,53 @@ compare them for equivalence. For example:
True
```

## Performance

Normalization performance comparison of this package (v0.3.7) with
the [text-icu](http://hackage.haskell.org/package/text-icu) package
using the [ICU C++ library](http://site.icu-project.org/download)
version ICU4C 65.1 on macOS. The benchmarks compare the time taken in
milliseconds to normalize files in different languages and normalization
forms using both the packages. In most cases `unicode-transforms`
outperforms ICU.

```
Benchmark unicode-transforms(ms) ICU(ms) % Diff
--------------- ---------------------- ------- --------
NFKD/Korean 7.78 37.10 +376.87
NFD/Korean 7.86 37.06 +371.50
NFKD/Vietnamese 6.85 12.48 +82.20
NFKD/Deutsch 2.17 3.55 +63.30
NFKD/English 1.71 2.78 +62.30
NFKC/Korean 4.77 7.65 +60.28
NFD/Deutsch 2.24 3.53 +57.41
NFD/English 1.76 2.77 +57.32
NFC/Vietnamese 10.66 16.63 +56.00
NFKC/Vietnamese 10.95 16.58 +51.43
NFD/Devanagari 6.48 8.68 +34.10
NFC/Devanagari 6.77 8.49 +25.48
NFD/AllChars 6.18 7.41 +19.91
NFD/Japanese 7.80 9.20 +17.99
NFKC/Devanagari 7.33 8.48 +15.74
NFKD/Japanese 8.71 10.05 +15.39
NFD/Vietnamese 5.94 6.83 +14.99
NFKD/Devanagari 7.59 8.68 +14.27
NFKD/AllChars 9.80 10.66 +8.82
NFKC/Deutsch 3.21 3.18 -0.72
NFC/Korean 4.62 4.38 -5.35
NFKC/English 2.21 2.06 -6.88
NFC/English 2.19 2.04 -7.21
NFKC/AllChars 14.67 9.75 -50.51
NFC/Deutsch 3.02 1.95 -54.39
NFKC/Japanese 12.46 5.42 -129.93
NFC/AllChars 9.72 3.58 -171.63
NFC/Japanese 11.90 3.04 -292.04
```

## Talks

* Talks: [Functional Conf 2018 Video](https://www.youtube.com/watch?v=aJvwORrBJ0o) | [Functional Conf 2018 Slides](https://www.slideshare.net/HarendraKumar10/high-performance-haskell)

## Contributing
Please use https://github.com/harendra-kumar/unicode-transforms to raise
issues, or send pull requests.
23 changes: 18 additions & 5 deletions benchmark/Chart.hs
Expand Up @@ -7,11 +7,18 @@ module Main where
import BenchShow
import Data.List

selectBench :: (SortColumn -> Either String [(String, Double)]) -> [String]
selectBench
:: (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)])
-> [String]
selectBench f =
-- reverse
fmap fst
$ either error (sortOn fst) $ f $ ColumnIndex 0
reverse
$ fmap fst
$ either
(const
$ either error (sortOn snd)
$ f (ColumnIndex 0) (Just PercentDiff))
(sortOn snd)
$ f (ColumnIndex 1) (Just PercentDiff)

main :: IO ()
main = do
Expand All @@ -24,7 +31,13 @@ main = do
Just x -> Just ("unicode-transforms",x)
Nothing -> error "unknown benchmark"
, selectBenchmarks = selectBench
, presentation = Groups PercentDiff
, selectGroups = \gs ->
filterGroup "unicode-transforms" gs ++ filterGroup "ICU" gs
, presentation = Groups Absolute
}
-- graph "results.csv" "unicode-graph" cfg
report "results.csv" Nothing cfg

where

filterGroup grp gs = filter (\(name,_) -> name == grp) gs
4 changes: 2 additions & 2 deletions unicode-transforms.cabal
Expand Up @@ -209,8 +209,8 @@ executable chart
buildable: True
build-Depends:
base >= 4.8 && < 5
, bench-show >= 0.2 && < 0.3
, split
, bench-show >= 0.3 && < 0.4
, split >= 0.2 && < 0.3
, transformers >= 0.4 && < 0.6
else
buildable: False

0 comments on commit 95b0ac1

Please sign in to comment.