That’s a big topic! Most has been explained elsewhere, so I won’t try to write a book chapter right here. Instead:
- Real World Haskell, ch 25, “Performance” – discusses profiling, simple specialization and unpacking, reading Core, and some optimizations.
Johan Tibell is writing a lot on this topic:
- Computing the size of a data structure
- Memory footprints of common data types
- Faster persistent structures through hashing
- Reasoning about laziness
And some things from here:
- Reading GHC Core
- How GHC does optimization
- Profiling for performance
- Tweaking GC settings
- General improvements
- More on unpacking
- Unboxing and strictness
And some other things: