Compiler allocations are sensitive to environment variables
It turns out that GHC's allocations are quite sensitive to environment variables:
$ HI="$(yes | head -n 10000)" ghc -Rghc-timing
ghc: no input files
Usage: For basic information, try the `--help' option.
<<ghc: 17523568 bytes, 17 GCs, 1243182/2375192 avg/max bytes residency (4 samples), 6M in use, 0.001 INIT (0.001 elapsed), 0.010 MUT (0.010 elapsed), 0.053 GC (0.054 elapsed) :ghc>>
$ HI="" ghc -Rghc-timing
ghc: no input files
Usage: For basic information, try the `--help' option.
<<ghc: 16368120 bytes, 16 GCs, 908760/1347632 avg/max bytes residency (3 samples), 5M in use, 0.001 INIT (0.000 elapsed), 0.009 MUT (0.009 elapsed), 0.036 GC (0.037 elapsed) :ghc>>
I suspect that the reason is the use of System.Environment.getEnvironment
(which decodes all environment variables into Haskell String
s) in GHC.HandleEncoding.configureHandleEncoding
. This could easily be changed to rather use getEnv
, which is far more surgical.