In the Shake documentation it recommends compiling using the flag -with-rtsopts=-I0
to disable idle garbage collection. Why does Shake recommend that?
Asked
Active
Viewed 743 times
16

Neil Mitchell
- 9,090
- 1
- 27
- 85
1 Answers
19
By default (without the flag) GHC performs a garbage collection (GC) if all Haskell threads have been idle for 0.3 seconds. Since a build system is regularly running external processes, it is quite common for all Haskell threads to be idle for > 0.3s, which causes a lot of unnecessary garbage collections. Since the machine is likely to be fully loaded from the processes Shake is running, the GC will take time away that could otherwise be doing useful work. The problem is exacerbated if the GC runs multi-threaded.

Neil Mitchell
- 9,090
- 1
- 27
- 85
-
2More generally, idle garbage collection is primarily for *interactive* applications, and also for concurrent situations where the application in question is likely to delay many other threads in a major collection. – dfeuer Jan 04 '16 at 23:22