Profiling measures a running program’s time and memory behavior so performance work begins with evidence rather than guesses. In the ladder-game solver, it identifies which operation is actually slowing the application. section 6.3.1
A practical profiling cycle is:
- Compile the Stack project with profiling enabled by passing --profile. section 6.3.1
- Run the executable with Haskell runtime options such as +RTS -p -RTS to request basic time and memory profiling. section 6.3.1
- Read the generated .prof report, which lists cost centers, execution time, and allocated memory. section 6.3.1
- Change the implementation, then profile again with a representative workload to see whether the bottleneck moved or disappeared. section 6.3.2
Finding the ladder solver’s bottleneck
A profiling run shows that lookup in an associative-list map consumes more than half the runtime. Replacing it with a HashMap makes lookup fast enough that candidate computation, and later file reading, become the dominant costs. The measurements therefore guide successive changes instead of prematurely optimizing unrelated code. section 6.3.1 section 6.3.2
shell $ stack run --profile -- \
path/to/small_dictionary.txt dog book +RTS -p -RTS
Run the ladder solver with profiling enabled and request a time-and-allocation report using the runtime system. section 6.3.1










