1. 2

    Thank you for making this! It’s always surprising to me (coming from Go and Node) when I find basic tooling like this that’s missing in Haskell.

    My work projects use Cabal, but I’ll take a look at adding Cabal support when I find the time.

    1. 1

      Sweet! Actually I added support tonight. I’ve never used a cabal.project file, so I kind of guessed, but if you want to try it out for a spin and let me know any issues in a DM please do: https://github.com/dfithian/prune-juice

    1. 2

      No mention of split-sections in the post or its “parent”? That should be the first step, not UPX or dynamic builds - let the linker do its job first.

      1. 1

        That’s great feedback! I didn’t know about split sections, I’ll look into it.

        Edit: Apparently split sections is turned on by default, and I have added it to the post.

        1. 1

          Apparently split sections is turned on by default,

          Don’t think so. Perhaps the issue linked points to split sections turned on by default for GHC itself.

          In my projects, enabling it explicitly shaves a lot from any executable produced.

          1. 2

            I don’t know what to tell you, but building with stack on macOS with the flag -split-sections errored the build because it said it was already turned on by default.

            1. 1

              Oh… My windows builds can’t into split-sections with stack either - linker crashes with too many sections ):

      1. 6

        Remember using upx could be a horrible idea for programs that have more than once instance running at once. Normally the kernel can share memory pages between different executions of the same program, upx defeats that.

        1. 2

          upx also doesn’t fix that the binary is (likely) not very cache-efficient

          1. 1

            I didn’t know about that specifically, so I’ll add a note about it. I kind of discounted dynamic linking as soon as I realized modern cloud deployment practices would mean only one executable per instance/VM, and I didn’t consider much by way of sharing instances after that

            Thanks for the feedback!

            1. 2

              On that topic, I wonder if you can reproduce the gains of UPX with some standard (non-autoextracting) compression. If that the case, then you might also gain the same benefits from on-the-wire compression when transferring the executable.

              1. 1

                Theoretically, the OS’ executable format can include compressing the pages, so then the kernel can expand the pages in a way that’d be shared across all packages.