Search code examples
haskellghcihaskell-platform

Benchmark in GHCi, how can I enable to show number of reductions for expression?


I am playing with GHCi and I wondering how can I enable in GHCi to raise the number of reduction in expression to compare different solutions?


Solution

  • Hugs had (has?) such an option.

    In GHCi, you can enter Prelude> :set +s to print rough timings after each evaluation. Then apply empirical orders of growth analysis as needed.

    For proper testing compile with the -O2 flag, and run standalone executables at your shell prompt with "+RTS -s" option to get the stats. Also, there's Criterion package.