Programming Tips - Where is the time is going in my perl script?

Date: 2010may20 Language: perl Keywords: profile, profiling, optimize, optimizing Q. Where is the time is going in my perl script? A. Here is a bash script that runs a nice profiler: --- Put this in /usr/local/bin/myprof ---
#!/bin/sh if [[ -f tmon.out ]]; then rm tmon.out fi perl -d:DProf $* if [[ ! -f tmon.out ]]; then exit fi
Then run:
myprof myscript.pl
dprofpp
The file tmon.out is created by the first step and used by the second. By default dprofpp only displays the 20 busiest routines. You can show more by doing:
dprofpp -O 100