www.idziorek.net | blog | contact

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


    -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