summaryrefslogtreecommitdiff
path: root/00_blog/00040_Haskell/00020_GHC-Notes/index.md
blob: acee63f1c7b1ff3757778bcb3babd46df0bae09d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# The Glasgow Haskell Compiler

## Some GHC Flags

        -v                      verbose mode
        -O2                     level 2 optimizations
        -rtsopts                allow +RTS flags
        -prof                   enable basic time and allocation profiling
        -auto-all               cost centers on all top level functions
                                (you can also add them via the SCC pragma)
        -fprof-auto             replaced -auto-all
        -caf-all                generate data for CAFs (constant applicative forms)
        -fprof-cafs             replaced -caf-all
        -fforce-recomp          force recompilation
        -threaded               Use threaed runtime
        -eventlog               enables +RTS -l flag

        -Wall
        -Werror

        -no-hs-main             supress linking main module

        Notes: you will obtain the profiling versions of dependancies via: 
               stack install --profile [libraryname]


## Some +RTS flags

        -K      set stack limit
        -s      statistic reporting
        -p      profiling
        -hc     extract heap profile
        -hy     allocation by type
        -hd     allocation by constructor
        -ix     x is sampling frequency in seconds. e.g. 0.01)
        -Nx     x is number of cores to utilize
        -l      emit log file (can be used threadscope)
        -ddump-simpl generate core 

        Note: render the heap profile as graph with: hp2ps -e8in -c file.hp
              show eventlog with: threadscope file.eventlog