perl script execution take a long time

G

gjain

Hi,

I am having a perl script.The main script calls some 10 subroutines
which are in the same file.
Execution time of the script take around 1 and half minute which is
not desirable.
Please tell me the way to reduce the execution time.

Thanks
Gaurav
 
U

Uri Guttman

g> I am having a perl script.The main script calls some 10 subroutines
g> which are in the same file.
g> Execution time of the script take around 1 and half minute which is
g> not desirable.
g> Please tell me the way to reduce the execution time.

remove line 38.

or show us the code so we can see where it is slow.

or use a profiling module to see where it is using the cpu.

uri
 
J

Jürgen Exner

gjain said:
I am having a perl script.The main script calls some 10 subroutines
which are in the same file.

So a rather small script.
Execution time of the script take around 1 and half minute which is
not desirable.
Please tell me the way to reduce the execution time.

You need to remove line 42.

jue
 
U

Uri Guttman

JE> So a rather small script.

JE> You need to remove line 42.

wrong! i already said to remove line 38. line 42 does not slow it down
at all!

uri
 
J

Jürgen Exner

Uri Guttman said:
JE> So a rather small script.


JE> You need to remove line 42.

wrong! i already said to remove line 38. line 42 does not slow it down
at all!

Impossible! Are you suggesting that Deep Thought was wrong?

jue
 
U

Uri Guttman

JE> Impossible! Are you suggesting that Deep Thought was wrong?

yes. he was off by 4!

uri
 
L

linuxlover

I am having a perl script.The main script calls some 10 subroutines
which are in the same file.
Execution time of the script take around 1 and half minute which is
not desirable.
Please tell me the way to reduce the execution time.

Buy a faster computer, or, as we say it here, throw more iron at it.

Seriously, did you expect that with the minimal information you gave,
that we can look in our crystal spheres and tell you what your problem
or its solution is? You need to give detailed information. Perhaps, in
accurately formulating the question and pinpointing the problem, you
might find the solution yourself.
 
R

RedGrittyBrick

gjain said:
Hi,

I am having a perl script.The main script calls some 10 subroutines
which are in the same file.
Execution time of the script take around 1 and half minute which is
not desirable.
Please tell me the way to reduce the execution time.

Find out where the bottlenecks are.
Eliminate inefficiencies in your code.
Use more appropriate algorithms.
Trade off RAM for time.

If you need help with any of the above, ask here. Posting complete
working code that illustrates your problem will be especially helpful in
getting your problem solved.
 
C

ccc31807

Please tell me the way to reduce the execution time.

I don't know what your script does, but in my experience it's usually
the data that causes scripts to slow.Run it with just one datum, 100
datums, 1,000,000 datums, and 1,000,000,000 datums, and graph the
running time. There's a Perl module called Hi Res that's useful for
that.

Realistically, a linear speedup is probably the best that can be hoped
for. If it's exponential (or worse) you might have some algorithms to
optimize.

CC
 
J

Jürgen Exner

ccc31807 said:
What he means is, code the computationally intensive parts of your
program in assembly.

From what I know about Tad rather not.
The vagueness of his answer matched the vagueness of the question
exactly. And if he meant something more specific (which I find unlikely)
then he was probably suggesting to choose a different more efficient
algorithm.

jue
 
P

Peter J. Holzer

g> I am having a perl script.The main script calls some 10 subroutines
g> which are in the same file.
g> Execution time of the script take around 1 and half minute which is
g> not desirable.
g> Please tell me the way to reduce the execution time.

remove line 38.

or show us the code so we can see where it is slow.

or use a profiling module to see where it is using the cpu.

Since nobody has mentioned it yet: Devel::NYTProf is IMHO the best
profiler for Perl.

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top