Karel Bílek
Karel Bílek

Reputation: 37724

Perl scripts suddenly compiling very slowly

Suddenly, compiling my perl scripts started taking too much time. (About a minute each)

It doesn'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?

Upvotes: 3

Views: 366

Answers (2)

bvr
bvr

Reputation: 9697

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.

Upvotes: 1

BMitch
BMitch

Reputation: 264986

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.

Upvotes: 5

Related Questions