Slow compile times

Kirsten Chevalier
Thu, 1 May 2003 16:38:02 -0700

I'm running GHC 5.04.3 on a Pentium IV machine with 1 GB of RAM, running
RedHat Linux 7.2 and gcc version 2.96. I'm experiencing some very slow
compile times; for the worst offender, a 1500-line module, -Rghc-timing
reports the following stats:
<<ghc: 3737832832 bytes, 14031 GCs, 31054695/68706248 avg/max bytes residency
(18 samples), 178M in use, 0.00 INIT (0.01 elapsed), 53.88 MUT (103.47
elapsed), 30.18 GC (31.42 elapsed) :ghc>>

I'm running GHC with the following options:
-fallow-overlapping-instances -cpp -O1 -fvia-C -fglasgow-exts -package text
 -dcore-lint -prof -auto-all +RTS -K48M -M1024M -RTS -fno-strictness 

Since the section on improving compile times in the users' guide suggests
adding more RAM if GC takes more than 20% of the time, I recently added
512 MB of RAM (bringing the total of 1 GB), but that doesn't seem to have
helped much; the "top" command says that GHC takes up at most 20% of available
memory, so it's not thrashing. All of my source code lives on a local disk,
so NFS isn't an issue either. I tried running with -v2 as the manual suggests,
but no single stage seems to stand out as being particularly slow. If anyone
could help me track this down, I'd much appreciate it. BTW, when I tried
compiling the same module with -O0 instead of -O1, I got the following stats:

<<ghc: 1477256508 bytes, 5319 GCs, 17428260/41019496 avg/max bytes residency
(16 samples), 104M in use, 0.00 INIT (0.01 elapsed), 15.64 MUT (68.13 elapsed),
13.44 GC (13.86 elapsed) :ghc>>

which is somewhat better, but it still seems like GC is taking up more time
than it should.


Kirsten Chevalier * * Often in error, never in doubt