Finding program bottlenecks

The best way to find out why a program is slow (and also, to optimize an already fast-running program), it to use the profiler.

This tool is included in the runtime system, and generates a report that shows what function in your program is the most time-consuming.