perl script execution take a long time

Discussion in 'Perl Misc' started by gjain, Sep 18, 2009.

  1. gjain

    gjain Guest

    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
     
    gjain, Sep 18, 2009
    #1
    1. Advertising

  2. gjain

    Uri Guttman Guest

    >>>>> "g" == gjain <> writes:

    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

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Sep 18, 2009
    #2
    1. Advertising

  3. gjain <> wrote:
    >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
     
    Jürgen Exner, Sep 18, 2009
    #3
  4. gjain

    Uri Guttman Guest

    >>>>> "JE" == Jürgen Exner <> writes:

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


    JE> 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.


    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

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Sep 18, 2009
    #4
  5. "Uri Guttman" <> wrote:
    >>>>>> "JE" == Jürgen Exner <> writes:

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

    >
    > JE> 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.

    >
    > 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
     
    Jürgen Exner, Sep 18, 2009
    #5
  6. gjain

    Uri Guttman Guest

    >>>>> "JE" == Jürgen Exner <> writes:

    JE> "Uri Guttman" <> wrote:
    >>>>>>> "JE" == Jürgen Exner <> writes:

    >>

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

    >>

    JE> 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.

    >>

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


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

    yes. he was off by 4!

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Sep 18, 2009
    #6
  7. gjain

    linuxlover Guest

    On 18 sep, 06:26, gjain <> wrote:

    > 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.
     
    linuxlover, Sep 18, 2009
    #7
  8. gjain wrote:
    > 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.

    --
    RGB
     
    RedGrittyBrick, Sep 18, 2009
    #8
  9. gjain

    ccc31807 Guest

    On Sep 18, 12:26 am, gjain <> wrote:
    > 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
     
    ccc31807, Sep 18, 2009
    #9
  10. gjain

    ccc31807 Guest

    On Sep 18, 10:23 am, Tad J McClellan <> wrote:
    > Write your program differently.


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

    CC.
     
    ccc31807, Sep 18, 2009
    #10
  11. ccc31807 <> wrote:
    >On Sep 18, 10:23 am, Tad J McClellan <> wrote:
    >> Write your program differently.

    >
    >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
     
    Jürgen Exner, Sep 18, 2009
    #11
  12. gjain

    ccc31807 Guest

    On Sep 18, 12:20 pm, Jürgen Exner <> wrote:
    > >What he means is, code the computationally intensive parts of your
    > >program in assembly.

    >
    > From what I know about Tad rather not.


    It was a joke. Maybe I should have used a smiley. ;-)

    CC.
     
    ccc31807, Sep 18, 2009
    #12
  13. On 2009-09-18 04:28, Uri Guttman <> wrote:
    >>>>>> "g" == gjain <> writes:

    >
    > 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
     
    Peter J. Holzer, Sep 19, 2009
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9obiBBbGVzc2U=?=

    winforms controls take a long time to load in IE

    =?Utf-8?B?Sm9obiBBbGVzc2U=?=, Feb 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,528
    john Alesse
    Feb 3, 2004
  2. Rod
    Replies:
    1
    Views:
    488
    Patrick Olurotimi Ige
    Dec 21, 2004
  3. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    728
    Eric Sosman
    Jul 8, 2003
  4. yuki999
    Replies:
    0
    Views:
    435
    yuki999
    Jan 2, 2008
  5. SJ

    Handling requests that take a long time.

    SJ, Dec 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    134
Loading...

Share This Page