Opened 2 years ago

Last modified 2 years ago

#14072 new bug

Code generated by GHC 8.2.1 faster than 8.0.1 but still somewhat slower than 7.10.3

Reported by: harendra Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Unicode normalization library ( shows around 10% improvement with GHC 8.2.1 when compared to GHC 8.0.1, across most benchmarks. However, it is still somewhat slower when compared to GHC 7.10.3. On the other hand, when compared to GHC 7.8.4, GHC 8.2.1 is marginally better.

This library has been optimized with an objective to match or better (in some cases it is better) the performance of the equivalent ICU C++ library (compare only decompose normalization). Some of the last hurdles to match the best case of C++ were in the code generated by GHC. I filed a couple of ghc trac tickets earlier on that.

You can reproduce these results easily as follows:

$ git clone
$ git checkout -b v0.3.3 v0.3.3
$ echo ghc-8.0
$ stack bench 
$ stack bench --stack-yaml stack-7.10.yaml
$ stack bench --stack-yaml stack-8.2.yaml

Here are some excerpts from the benchmarks:

GHC 7.10.3:

benchmarking unicode-transforms-text/NFD/English
time                 4.823 ms   (4.765 ms .. 4.902 ms)

benchmarking unicode-transforms-text/NFD/Deutsch
time                 5.607 ms   (5.522 ms .. 5.673 ms)

GHC 8.0.1

benchmarking unicode-transforms-text/NFD/English
time                 6.330 ms   (6.232 ms .. 6.439 ms)

benchmarking unicode-transforms-text/NFD/Deutsch
time                 7.109 ms   (7.034 ms .. 7.183 ms)

GHC 8.2.1

benchmarking unicode-transforms-text/NFD/English
time                 5.659 ms   (5.594 ms .. 5.740 ms)

benchmarking unicode-transforms-text/NFD/Deutsch
time                 6.406 ms   (6.329 ms .. 6.478 ms)

Change History (2)

comment:1 Changed 2 years ago by simonpj

I filed a couple of ghc trac tickets earlier on that.

Can you be specific? Which tickets?

comment:2 Changed 2 years ago by harendra

In a quest to extract every last drop of perf in this library so that I can beat the gcc version, I investigated the GHC generated code and filed these tickets #12231 and #12232.

Note: See TracTickets for help on using tickets.