Show Menu

GHC and RTS Options Cheat Sheet by


show runtim­e-s­ystem statistics
save runtim­e-s­ystem statistics to file
+RTS -tfile
all bindings not marked INLINE
all top-level bindings not marked INLINE
all exported bindings nto marked INLINE
all call sites

Flow of Heap Profiling

compiling with
-prof -fprof­-auto -rtsopts
running with
+RTS -h
visual­izing with
hp2ps *.hp
colored OUTPUT
hp2ps -c *.hp

- category setting

break by cost-c­enter
break by module
break by constr­uct­or/­closure
break by type

- hp2ps options

place rough bands on top
big box for title
EPS for latex
for preview
limit to n bands
use the previous parameters
color output
ignore marks
print help

Flow of Time Profiling

compiling with
-prof -fprof­-auto -rtsopts
running with
+RTS -p

Flow of Stack Trace

compiling with
-prof -fprof­-auto -rtsopts
running with
+RTC -xc

Flow of Code Coverage

compiling with
no options need
hpc report tix file
making html files
hpc markup tix file
Coverage data is stored in *.tix file.

- hpc options

display help
hpc help
report coverage
hpc report
make html files
hpc markup
sum multiple coverages
hpc sum
combine two coverages
hpc combine
show in verbose mode
hpc show
display version
hpc version


optimi­zation level
-On (n =1,2,3,4)
no optimi­zation
make constr­uctor fields strict
static argument transf­orm­ation
for IO/ST monad

RTS options for GC

allocation area size
-Asize (default: 512KB)
suggested heap size
-Hsize (default: 0KB)
maximum heap size
-Msize (default: unlimited)


Native Code Generator
-fvia-c is obsolete.

SMP Parall­elism

use thread
avoid repeated comput­ation of thunks
avoid waiting
use n threads
+RTS -Nn
use all processors
pin threads
+RTS -qa
enable auto thread migration
+RTS -qm

- debug parall­elism

make eventlog of parallel sparks (sampled)
-lp (default)
make eventlog of parallel sparks (fully accurate)
eventlog is stored as *.eventlog


Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Regular Expressions Cheat Sheet
          Python Cheat Sheet