How do you write data structures that are as efficient as possible in GHC? [closed]

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:

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:

Leave a Comment