brendanhay / gogol

A comprehensive Google Services SDK for Haskell.
Other
281 stars 105 forks source link

Extreme memory usage building gogol-youtube #132

Open LSLeary opened 5 years ago

LSLeary commented 5 years ago

Compiling the Network.Google.YouTube.Types.{Sum,Product} modules with ghc 8.4.4 or 8.6.5 takes ten minutes each and uses 7GB of RAM (that's with -j1). I haven't tried 8.2.2 or 8.8.1 properly, since the versions of the dependencies that nix picked failed to build for unrelated reasons.

On my laptop with 8GB RAM it's a struggle; after closing my browser and pushing most other processes into swap it's still juggling the last 20–30MB of RAM and is essentially unusable for anything else until the build finishes.

They seem to be huge modules full of big types, each deriving various instances. I gather that is indeed a recipe for just this problem—perhaps the generation can be tweaked to split up oversized modules? I'm not sure, but that would probably reduce the peak memory usage.