Hi


Summary:
If I access the script in question (on a webserver) from my machine, it returns results in 0.5 seconds. For everyone else, it takes 30 seconds.

Script setup:
I have a script that is called directly with no arguments (eg http://domain.com/cgi-bin/script.pl) and returns HTML generated from a template file and database file located on the same server as the script. It is hosted on a Windows2000 server (not my choice) running ActivePerl. The ISP it is hosted on is different to my IPP.

Problem:
If I call http://domain.com/cgi-bin/script.pl I get the HTML returned in 0.5 seconds (even if I shift-refresh). Everyone else seemingly waits 30 seconds for the generated HTML to be displayed.

Attempted Troubleshooting:
I tried adding a coded 'stopwatch' to the script. It is started on the first line of the script and is stopped right before the output - the output of the stopwatch is then printed rather than the final two lines of the script, which are:
print $html_output;
exit;

Troubleshooting Results:
If I do this, everyone can read the stopwatch output in 0.5 secs of acessing the script (they get a total 'script running' time of under a second).

I have been coding perl for 3-4 years, albeit not as a professional, and this completely baffles me. If anyone is willing to help, I would be willing to email them a copy of the script if necessary. I am loathe to post the code here in full for fear of a horde of comments criticising my code without addressing the problem.

Thank you

Daniel Adams

In reply to Huge variance in script run time by Daniel Adams

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.