
On Tue, Sep 30, 2014 at 7:44 PM, John Lato
Hi Edward,
This is possibly unrelated, but the setup seems almost identical to a very similar problem we had in some code, i.e. very long compile times (6+ minutes for 1 module) and excessive memory usage when compiling generic serialization instances for some data structures.
In our case, I also thought that INLINE functions were the cause of the problem, but it turns out they were not. We had a nested data structure, e.g.
data Foo { fooBar :: !Bar, ... }
with Bar very large (~150 records).
even when we explicitly NOINLINE'd the function that serialized Bar, GHC still created a very large helper function of the form:
serialize_foo :: Int# -> Int# -> ...
where the arguments were the unboxed fields of the Bar structure, along with the other fields within Foo.
This sounds very much like the bug Richard fixed in https://ghc.haskell.org/trac/ghc/ticket/9233. (See "g/F.hs" from my "minimized.tar.gz".) If so then I think it is actually caused simply by creating the worker function, and doesn't have to do with unpacking, only the strictness of the Bar field. Regards, Reid Barton