🚀 Wow, a riveting tale about squeezing the bloat out of #Haskell binaries. Because who wouldn't want to spend their weekend optimizing code so niche it's basically a hipster's dream? 🧙♂️✨ Just embrace the 100MB, folks; your hard drives can handle it! 😂
https://brandon.si/code/linking-smaller-haskell-binaries/ #Optimization #CodeNiche #WeekendBloatReduction #HipsterCoding #HackerNews #ngated
https://brandon.si/code/linking-smaller-haskell-binaries/ #Optimization #CodeNiche #WeekendBloatReduction #HipsterCoding #HackerNews #ngated
Linking Smaller Haskell Binaries | Brandon Simmons' website
Haskell binaries can get quite large (think ~100MB), especially for projects with many transitive dependencies. Here are two strategies that can help at link time, the latter being more experimental. I used the test-pandoc binary from pandoc on GHC 9.2.5 below. This was nice because obviously it was easy to test if linking broke anything (just run the tests). -split-sections and --gc-sections You can instruct ghc to emit code in individual minimal sections, allowing the linker to easily find and remove dead code. This looks like, in your cabal.project: