Suddenly, compiling my perl scripts started taking too much time. (About a minute each)
It doe开发者_如何学编程sn't really matter what I have in the scripts, what does matter, however, is how many require
and use
I use.
I think it is in compiling, but I am not sure. The thing is - if I run only the checking part - meaning, perl -c script.h
, it takes about the same time.
My question is - how to debug it, how to find out, what exactly is perl doing, to find out what takes so much time?
You can check how long each use an require command takes to load with something like the following (time is a unix/linux command, so on Windows you'll need to keep an eye on your watch):
$ time perl -c -e 'use strict;'
-e syntax OK
real 0m0.122s
user 0m0.000s
sys 0m0.008s
Just change the use/require line for each entry you have to find which one results in the longest time.
If you are on Windows, you could use Process Monitor utility to see disk I/O activity. If you have suspicion on Moose, running isolated script could show what is loaded and when.
精彩评论