Need for speed
GHC produces pretty fast code by most standards. After Well-Typed put some development effort towards faster code it’s now even faster, with a reduction in runtime of 3-4%.
As a disclaimer, these numbers are based on nofib benchmarks. Actual benefits for individual programs can vary. However I’m confident that this will benefit any reasonably large program to some degree.
These changes were implemented over the summer by me (Andreas Klebinger) for Well-Typed. The changes will be in GHC 8.10 which is scheduled to be released early next year. So hopefully users won’t have to wait long to get these benefits.
So what did I change?
Here is a list of potentially user-facing changes as a result of this work. Not included are GHC internal changes which shouldn’t be user visible.
- Code layout redux: ~1-2% faster executables through better placement of code in binaries.
- Fixed a bug in the Windows linker.
- 20% smaller interface files through variable length encodings.
- Tune the number of precomputed Int closures: ~1% faster executables.
- Optimize case/switch statements better: ~1% faster executables. Much faster code in certain edge cases.
In the rest of this post, I will go over these changes in more detail …(read more)