in reply to help on compilation profiling
Probably one of the modules you are using is doing something more that just being compiled. For instance, resolving some hostnames, trying to stablish some connection with a remote server, etc.
How is your CPU load over that 2-3 minutes?. Compiling would use 100%. On the other hand, if it is doing nothing over a long period, use strace or a similar utility to monitor your script at the OS level and found what it is waiting for.
Finally, you can also use a divide and conquer approach to find the slow loading module, insert sentences like the ones below between the use calls:
BEGIN { $| = 1; printf "%d: Foo\n", time } use Foo; BEGIN { printf "%d: Bar\n", time } use Bar; BEGIN { printf "%d: all modules loaded\n", time }
|
|---|