If you've gotten it down to that particular block of code, can you manage to break it down further, and track down exactly which line is the worst offendor?

The only times I've seen print be a major problem was when I was passing around rather large strings through a series of functions (by 'rather large', they were in excess of a 500k), concatinating as it went through the functions.) -- so it wasn't really the print, it was the concatination, and assigning large strings based on the return of the functions. We changed the logic so we were passing around an array of strings, and printing that, and it shaved a few seconds off our time.

Also, be careful of the "<<HTML" example that you've given -- it would also insert extra line returns (probably not an issue for HTML, but could be an issue for other situations


In reply to Re^3: CGI print statements taking forever by jhourcle
in thread CGI print statements taking forever by traxlog

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.